8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 76551b0 commit fcb1c49Copy full SHA for fcb1c49
10_fibonacci/solution/fibonacci-solution.js
@@ -2,16 +2,18 @@ const fibonacci = function(count) {
2
if (count < 0) return "OOPS";
3
if (count === 0) return 0;
4
5
- let first_prev = 1;
6
- let second_prev = 0;
+ let firstPrev = 1;
+ let secondPrev = 0;
7
8
+ // For clarification: curr stands for current. This is standard syntax
9
+
10
for (let i = 2; i <= count; i++) {
- let curr = first_prev + second_prev;
- second_prev = first_prev;
11
- first_prev = curr;
+ let curr = firstPrev + secondPrev;
12
+ secondPrev = firstPrev;
13
+ firstPrev = curr;
14
}
15
- return first_prev;
16
+ return firstPrev;
17
};
18
19
module.exports = fibonacci;
0 commit comments