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

8 lines
187 B
JavaScript

export function fibonacci(value) {
// implementar logica aqui
const fibo = [0, 1]
for (let i = 2; i <= value; i++) {
fibo[i] = fibo[i-1] + fibo[i-2]
}
return fibo[value]
}