forked from M3-Academy/challenge-algorithms-v2.0
feat(fibonacci):adicionando funcionalidade
This commit is contained in:
parent
2526b5122b
commit
c7af3bfd17
@ -1,4 +1,13 @@
|
|||||||
export function fibonacci(value) {
|
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
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user