function fib(n) { let [first, second] = [0, 1]; return function() { console.log(first); [first, second] = [second, first + second]; } } console.log("The Fibonacci Sequence"); const f = fib(); for (let i = 0; i < 10; i++) { f(); }