refactor(fibanacci):melhorando visualmente o codigo

This commit is contained in:
Gabriel Bernardini 2022-10-31 00:41:33 -03:00
parent 6164b52cf0
commit 10d206ebcf

View File

@ -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
}