Skip to content

Instantly share code, notes, and snippets.

Created Feb 8, 2018
What would you like to do?
function* gen(i) {
let m = yield {o: i, n: ++i};
m = yield {o: m, n: ++m};
m = yield {o: m, n: ++m};
let g = gen(3);
let {o, n} =;
console.log(o, n);
-> 3, 4
let {o: a, n: b} =;
console.log(a, b);
-> 4, 5
let {o: c, n: d} =;
console.log(c, d);
-> 5, 6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment