Skip to content

Instantly share code, notes, and snippets.

@jooyunghan
Last active December 2, 2016 01:59
Show Gist options
  • Save jooyunghan/99afa33e2aa69e52cd74ee2569be2cee to your computer and use it in GitHub Desktop.
Save jooyunghan/99afa33e2aa69e52cd74ee2569be2cee to your computer and use it in GitHub Desktop.
Babel-transpiled generator(fibo)
"use strict";
var _marked = [fibo].map(regeneratorRuntime.mark);
function fibo() {
var a, b;
return regeneratorRuntime.wrap(function fibo$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
a = 0, b = 1;
case 1:
if (!true) {
_context.next = 8;
break;
}
_context.next = 4;
return a;
case 4:
b = a + b;
a = b - a;
_context.next = 1;
break;
case 8:
case "end":
return _context.stop();
}
}
}, _marked[0], this);
}
function* fibo() {
let a=0, b=1
while (true) {
yield a
b = a + b
a = b - a
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment