Skip to content

Instantly share code, notes, and snippets.

@sbatson5
Created September 27, 2019 14:48
Show Gist options
  • Select an option

  • Save sbatson5/6491612e9c9835aa346c1c315ae4478e to your computer and use it in GitHub Desktop.

Select an option

Save sbatson5/6491612e9c9835aa346c1c315ae4478e to your computer and use it in GitHub Desktop.
function* genFunction() {
yield 'Hi there!';
yield 'Is this working?';
yield 'Bye ๐Ÿ‘‹';
};
const ourMethod = genFunction();
ourMethod.next();
// {value: "Hi there!", done: false}
ourMethod.next();
// {value: "Is this working?", done: false}
ourMethod.next();
// {value: "Bye ๐Ÿ‘‹", done: false}
ourMethod.next();
// {value: undefined, done: true}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment