Update fibonacci/fibonacci.js

Co-authored-by: Eric Olkowski <70952936+thatblindgeye@users.noreply.github.com>
This commit is contained in:
Florent-Vasseur 2023-01-22 11:29:14 +01:00 committed by GitHub
parent 9b13e06ecd
commit 46c3c25d46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -4,7 +4,8 @@ const fibonacci = function(count) {
let a = 0; let a = 0;
let b = 1; let b = 1;
for (let i = 1; i < count; i++) { for (let i = 1; i < count; i++) {
[a, b] = [b, a+b]; // A slightly shorter version of the above solution:
// [a, b] = [b, a + b];
} }
return b; return b;
}; };