From 10d206ebcf0674bedb3240ac6c76d08d7750fe2b Mon Sep 17 00:00:00 2001 From: Gabriel Bernardini Date: Mon, 31 Oct 2022 00:41:33 -0300 Subject: [PATCH] refactor(fibanacci):melhorando visualmente o codigo --- 04-fibonacci/index.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/04-fibonacci/index.js b/04-fibonacci/index.js index 115f625..d9d6de8 100644 --- a/04-fibonacci/index.js +++ b/04-fibonacci/index.js @@ -1,12 +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 + 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