13 lines
263 B
JavaScript
13 lines
263 B
JavaScript
export function fibonacci(value) {
|
|
// implementar logica aqui
|
|
let first = 0;
|
|
let second = 1;
|
|
if (value <= 1) {
|
|
return value;
|
|
}
|
|
for(let i = 3; i <= value; i++){
|
|
second = first + second;
|
|
first = second - first;
|
|
}
|
|
return first + second;
|
|
} |