Update fibonacci.js

I made the exchange of value shorter.
This commit is contained in:
Florent-Vasseur 2022-08-19 17:18:28 +02:00 committed by GitHub
parent db998d7279
commit 9b13e06ecd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 3 deletions

View File

@ -4,9 +4,7 @@ const fibonacci = function(count) {
let a = 0;
let b = 1;
for (let i = 1; i < count; i++) {
const temp = b;
b = a + b;
a = temp;
[a, b] = [b, a+b];
}
return b;
};