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

11 lines
193 B
JavaScript

export function fibonacci(value) {
// implementar logica aqui
let a = 0, b = 1, c = value;
for (let i = 2; i <= value; i++) {
c = a + b;
a = b;
b = c;
}
return c;
}