Update fibonacci-solution.js
This commit is contained in:
parent
fcb1c4971a
commit
51572a070c
|
@ -4,13 +4,11 @@ const fibonacci = function(count) {
|
||||||
|
|
||||||
let firstPrev = 1;
|
let firstPrev = 1;
|
||||||
let secondPrev = 0;
|
let secondPrev = 0;
|
||||||
|
|
||||||
// For clarification: curr stands for current. This is standard syntax
|
|
||||||
|
|
||||||
for (let i = 2; i <= count; i++) {
|
for (let i = 2; i <= count; i++) {
|
||||||
let curr = firstPrev + secondPrev;
|
let current = firstPrev + secondPrev;
|
||||||
secondPrev = firstPrev;
|
secondPrev = firstPrev;
|
||||||
firstPrev = curr;
|
firstPrev = current;
|
||||||
}
|
}
|
||||||
|
|
||||||
return firstPrev;
|
return firstPrev;
|
||||||
|
|
Loading…
Reference in New Issue