forked from M3-Academy/challenge-algorithms-v2.0
13 lines
265 B
JavaScript
13 lines
265 B
JavaScript
export function fibonacci(value) {
|
|
// implementar logica aqui
|
|
let fibo = [];
|
|
let i = 0;
|
|
for (i = 0 ; i <= value; i++) {
|
|
if (i < 2)
|
|
fibo[i] = i;
|
|
else
|
|
fibo[i] = fibo[i-1] + fibo[i-2];
|
|
}
|
|
return fibo[value];
|
|
|
|
} |