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