feat(fibonacci):adicionando funcionalidade

This commit is contained in:
Victor Cardoso de Souza 2022-10-31 16:34:44 -03:00
parent 2526b5122b
commit c7af3bfd17

View File

@ -1,4 +1,13 @@
export function fibonacci(value) {
// implementar logica aqui
let add = 0
let previousValue = 0
let nextValue = 1
for (let i = 0; i < value; i++) {
add = previousValue + nextValue;
previousValue = nextValue;
nextValue = add;
}
return previousValue
}