JavaScript Jabber
JavaScript Jabber
Charles M Wood
JSJ 469: The Case for JavaScript Iterators and Generators, part 2
1 hour 18 minutes Posted Feb 2, 2021 at 11:00 am.
0:00
1:18:25
Download MP3
Show notes
This is the follow on to the episode first recorded regarding JavaScripts iterators and generators. Dan takes the lead and picks up from last time. The panel discusses how JavaScript uses and implements iterators and where people are likely to see them. Then they dive into generators and briefly discuss the concept and their uses.
CODE:
  • x = {[Symbol.iterator]() {let i = 0;return {next: () => ({done: i >= 10,value: i++})};}};
  • for (const v of x) console.log(v);
  • console.log([…x]);
  • console.log(…x);
  • function* g() {for (let i = 0; i < 10; ++i) yield i;}
Panel
  • AJ O'Neal
  • Charles Wood
  • Dan Shappir
Sponsors
Links
Picks
Sponsored By:


Support this podcast at — https://redcircle.com/javascript-jabber/donations

Privacy & Opt-Out: https://redcircle.com/privacy