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 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;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue