Update fibonacci.js

I made the exchange of value shorter
This commit is contained in:
Florent-Vasseur 2022-08-19 17:12:53 +02:00 committed by GitHub
parent db998d7279
commit 4c3ce5e969
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 a = 0;
let b = 1; let b = 1;
for (let i = 1; i < count; i++) { for (let i = 1; i < count; i++) {
const temp = b; [a, b] = [b, a+b]
b = a + b;
a = temp;
} }
return b; return b;
}; };