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

13 lines
208 B
JavaScript
Raw Normal View History

export function fibonacci(value) {
// implementar logica aqui
2022-10-29 03:18:27 +00:00
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;
}