forked from M3-Academy/challenge-algorithms-v2.0
14 lines
271 B
JavaScript
14 lines
271 B
JavaScript
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
|
|
} |