Home Flight manual By tags Ramblings Colophon RSS

Flight manual for es6

JavaScript's generator function*

  • 7-minute read
  • tagged javascript, es6

ECMAScript ("JavaScript" for the uninitiated) catches quite a bit of flak for numerous reasons online, but it can boast some truly spectacular expressiveness, possibly somewhat unmatched when paired with savvy TypeScript sauce that would make a Rustacean blush.

You've no doubt come across the destructuring syntax to effectively return multiple values from a single function, but we can do even better: we can return multiple times from the same invocation.

Possibly mad yet patently beautiful, let's explore the generator.

Continue reading →