forked from M3-Academy/challenge-algorithms-v2.0
fix(fibonacci)terminando
This commit is contained in:
parent
cf38216fbf
commit
d093b52fe1
@ -1,13 +1,11 @@
|
||||
export function fibonacci(value) {
|
||||
var i;
|
||||
var fib = [0, 1];
|
||||
let i;
|
||||
const fib = [0, 1];
|
||||
let numero = undefined;
|
||||
for (i = 2; i <= value; i++) {
|
||||
fib[i] = fib[i - 2] + fib[i - 1];
|
||||
numero = fib[i];
|
||||
}
|
||||
|
||||
if (numero !== undefined) return numero;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user