Update fibonacci/fibonacci.js

top !

Co-authored-by: Eric Olkowski <70952936+thatblindgeye@users.noreply.github.com>
This commit is contained in:
Florent-Vasseur 2023-01-23 08:54:06 +01:00 committed by GitHub
parent 46c3c25d46
commit cc0badd69c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -4,6 +4,9 @@ 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 slightly shorter version of the above solution:
// [a, b] = [b, a + b];
}