diff --git a/04-fibonacci/index.js b/04-fibonacci/index.js index de17e9a..455d010 100644 --- a/04-fibonacci/index.js +++ b/04-fibonacci/index.js @@ -4,16 +4,10 @@ export function fibonacci(value) { return value; } - // const resultado = fibonacci(value - 1) + fibonacci(value - 2); - // return resultado; - let arr = [0, 1]; - + for (let i = 2; i < value + 1; i++) { arr[i] = arr[i - 2] + arr[i - 1]; } return arr[value]; -} - -let f = fibonacci(46); -console.log(f); \ No newline at end of file +} \ No newline at end of file