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

9 lines
190 B
JavaScript
Raw Normal View History

export function fibonacci(value) {
// implementar logica aqui
2022-10-28 11:40:42 +00:00
let arr = [0, 1];
for (let i = 2; i < value + 1; i++) {
arr.push(arr[i - 2] + arr[i - 1]);
}
return arr[value];
}