forked from M3-Academy/challenge-algorithms-v2.0
19 lines
450 B
JavaScript
19 lines
450 B
JavaScript
export function fibonacci(value) {
|
|
// implementar logica aqui
|
|
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;
|
|
|
|
for (var i = 2; i < number; i++) {
|
|
fibonacci[i] = fibonacci[i - 2] + fibonacci[i - 1];
|
|
}
|
|
return fibonacci;
|
|
}
|
|
var f = GenerateFibonacci(10);
|
|
console.log(f); |