feat(fibonacci):aplicando a função no teste 4

This commit is contained in:
Gabriel Bernardini 2022-10-29 12:26:02 -03:00
parent 961116c5b2
commit 518d2f4275

View File

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