From 10b8f2fd451129b8df17b3f5b559a4c742a5d95c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Naian=20F=C3=A9lix?= Date: Fri, 28 Oct 2022 08:42:28 -0300 Subject: [PATCH] feat: resolve fibonacci --- 04-fibonacci/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/04-fibonacci/index.js b/04-fibonacci/index.js index 37c64cc..1959a9a 100644 --- a/04-fibonacci/index.js +++ b/04-fibonacci/index.js @@ -1,4 +1,15 @@ export function fibonacci(value) { // implementar logica aqui + let val1 = 0 + let val2 = 1 + let valFib + + for (let i = 1; i <= value; i++){ + valFib = val2 + val1 + val1 = val2 + val2 = valFib + } + + return val1 } \ No newline at end of file