From 518d2f4275b947bbd92841ab91004a94376dc648 Mon Sep 17 00:00:00 2001 From: Gabriel Bernardini Date: Sat, 29 Oct 2022 12:26:02 -0300 Subject: [PATCH] =?UTF-8?q?feat(fibonacci):aplicando=20a=20fun=C3=A7=C3=A3?= =?UTF-8?q?o=20no=20teste=204?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 04-fibonacci/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/04-fibonacci/index.js b/04-fibonacci/index.js index 37c64cc..115f625 100644 --- a/04-fibonacci/index.js +++ b/04-fibonacci/index.js @@ -1,4 +1,12 @@ export function fibonacci(value) { // implementar logica aqui - + let fib2 = 0 + let fib1 = 1 + let fibVal = 0 + for (let i = 1; i <=value; i++){ + fibVal = fib1 + fib2 + fib2 = fib1 + fib1 = fibVal + } + return fib2 } \ No newline at end of file