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

19 lines
450 B
JavaScript
Raw Normal View History

export function fibonacci(value) {
// implementar logica aqui
2022-11-02 02:36:09 +00:00
var fibonacci = [];
var fibonacci [0] = 0;
var fibonacci [1] = 1;
var fibonacci [2] = 2;
var fibonacci [3] = 3;
var fibonacci [4] = 4;
var fibonacci [5] = 5;
var fibonacci [6] = 6;
var fibonacci [7] = 7;
2022-11-02 02:36:09 +00:00
for (var i = 2; i < number; i++) {
fibonacci[i] = fibonacci[i - 2] + fibonacci[i - 1];
}
return fibonacci;
}
var f = GenerateFibonacci(10);
console.log(f);