Update fibonacci.js
I made the exchange of value shorter.
This commit is contained in:
parent
db998d7279
commit
9b13e06ecd
|
@ -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;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue