forked from M3-Academy/challenge-algorithms-v2.0
refactor(fibanacci):melhorando visualmente o codigo
This commit is contained in:
parent
6164b52cf0
commit
10d206ebcf
@ -1,12 +1,12 @@
|
||||
export function fibonacci(value) {
|
||||
// implementar logica aqui
|
||||
let fib2 = 0
|
||||
let fib1 = 1
|
||||
let fibVal = 0
|
||||
for (let i = 1; i <=value; i++){
|
||||
fibVal = fib1 + fib2
|
||||
fib2 = fib1
|
||||
fib1 = fibVal
|
||||
}
|
||||
return fib2
|
||||
let fib2 = 0
|
||||
let fib1 = 1
|
||||
let fibVal = 0
|
||||
for (let i = 1; i <=value; i++){
|
||||
fibVal = fib1 + fib2
|
||||
fib2 = fib1
|
||||
fib1 = fibVal
|
||||
}
|
||||
return fib2
|
||||
}
|
Loading…
Reference in New Issue
Block a user