Skip to content

Instantly share code, notes, and snippets.

@goofmint

goofmint/index.js

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