fix(fibonacci)terminando

This commit is contained in:
Andresa Rodrigues Figueira Combat 2022-11-02 15:02:19 -03:00
parent cf38216fbf
commit d093b52fe1

View File

@ -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;
}