Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Generators

  • Generators are functions that provide us with an iterator
  • Generator objects can be paused and made to return a value using the yield keyword
  • Calling next() resumes the function and we get successive values
  • Async generators combine the power of async/await and generators