Update fibonacci/fibonacci.js
Co-authored-by: Eric Olkowski <70952936+thatblindgeye@users.noreply.github.com>
This commit is contained in:
parent
9b13e06ecd
commit
46c3c25d46
|
@ -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;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue