mirror of
https://github.com/10h30/odin-javascript-exercises.git
synced 2026-06-05 15:09:09 +09:00
Update fibonacci-solution.js
This commit is contained in:
@@ -4,13 +4,11 @@ const fibonacci = function(count) {
|
||||
|
||||
let firstPrev = 1;
|
||||
let secondPrev = 0;
|
||||
|
||||
// For clarification: curr stands for current. This is standard syntax
|
||||
|
||||
for (let i = 2; i <= count; i++) {
|
||||
let curr = firstPrev + secondPrev;
|
||||
let current = firstPrev + secondPrev;
|
||||
secondPrev = firstPrev;
|
||||
firstPrev = curr;
|
||||
firstPrev = current;
|
||||
}
|
||||
|
||||
return firstPrev;
|
||||
|
||||
Reference in New Issue
Block a user