var fib = (function () {
let current = 0;
let next = 1;
return function (increment) {
for (var i = 0; i < increment; i++) {
[current, next] = [next, current + next]
}
return current
};
})();
This is an example of an implementation of a Fibonacci sequence as shown in this post. The same optimizations still apply, but I think this is nicer (in my opinion) then using yield.Edit: Altogether, good show. I enjoyed the post.