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

14 lines
271 B
JavaScript
Raw Normal View History

export function fibonacci(value) {
// implementar logica aqui
let fibM = value;
let fibMinus1 = 0;
let fibMinus2 = 1;
for (let i = 0; i < value; i++) {
fibM = fibMinus1 + fibMinus2;
fibMinus1 = fibMinus2;
fibMinus2 = fibM;
}
return fibMinus1
}