challenge-algorithms-v2.0-A.../04-fibonacci/index.js

13 lines
208 B
JavaScript

export function fibonacci(value) {
// implementar logica aqui
let soma = 0;
let n1 = 0;
let n2 = 1;
for (let i = 0; i < value; i++) {
soma = n1 + n2
n1 = n2
n2 = soma
}
return n1;
}