Update fibonacci-solution.js

This commit is contained in:
Nathan 2023-07-06 09:47:20 -05:00 committed by GitHub
parent fcb1c4971a
commit 51572a070c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 4 deletions

View File

@ -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;