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

8 lines
188 B
JavaScript
Raw Normal View History

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