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

13 lines
206 B
JavaScript
Raw Permalink Normal View History

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