JSJ 469: The Case for JavaScript Iterators and Generators, part 2

JavaScript Jabber

Episode | Podcast

Date: Tue, 02 Feb 2021 11:00:00 +0000

<div class="trix-content"> <div>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.</div><div>CODE:</div><ul> <li>x = {[Symbol.iterator]() {let i = 0;return {next: () =&gt; ({done: i &gt;= 10,value: i++})};}};</li> <li>for (const v of x) console.log(v);</li> <li>console.log([…x]);</li> <li>console.log(…x);</li> <li>function* g() {for (let i = 0; i &lt; 10; ++i) yield i;}</li> </ul><div>Panel</div><ul> <li>AJ O'Neal</li> <li>Charles Wood</li> <li>Dan Shappir</li> </ul><div>Sponsors</div><ul> <li><a href="https://https://devchat.tv/fast">Dexecure</a></li> <li><a href="https://raygun.com/?utm_medium=podcast&amp;utm_source=jsjabber&amp;utm_campaign=devchat&amp;utm_content=homepage">Raygun | Click here to get started on your free 14-day trial</a></li> <li><a href="http://devchat.tv/nextlevel">Next Level Mastermind</a></li> </ul><div>Links</div><ul> <li><a href="https://www.wix.engineering/post/a-promise-of-a-bright-future-with-async-iterators-generators-and-pipes-part-1">A Promise of a Bright Future With Async Iterators, Generators, and Pipes, Part 1</a></li> <li><a href="https://devchat.tv/js-jabber/jsj-437-inside-the-brave-browser-with-jonathan-sampson/">Devchat.tv | JSJ 437: Inside the Brave Browser with Jonathan Sampson</a></li> <li><a href="https://amzn.to/3cwtvGy">Flint 4k</a></li> </ul><div>Picks</div><ul> <li>AJ- Charles Wood</li> <li>AJ- <a href="https://amzn.to/3pFAVuM">12 Rules for Life Poster</a> </li> <li>AJ- <a href="https://brave.com/">Brave Browser</a> </li> <li>AJ- <a href="https://amzn.to/36u5gox">Need for Speed Hot Pursuit (Remastered)</a> </li> <li>Charles- <a href="https://devchat.tv/show/the-dev-rev/">Devchat.tv | The Dev Rev</a> </li> <li>Charles- <a href="https://mostvaluable.dev/">Most Valuable Developer</a> </li> <li>Charles- <a href="https://amzn.to/3r1fZ1M">Elgato Cam Link 4K</a> </li> <li>Charles- <a href="https://podcastplaybook.co/">Podcast Playbook</a> </li> <li>Charles- <a href="https://amzn.to/3cxjGrV">The Hero with a Thousand Faces by Joseph Campbell</a> </li> <li>Dan- <a href="https://www.netflix.com/title/80234304">Netflix Series: The Queen's Gambit</a> </li> <li>Dan- <a href="https://web.dev/autowebperf/">Automating audits with AutoWebPerf</a> </li> </ul><div>Sponsored By:</div><ul> <li> <a href="https://raygun.com/?utm_medium=podcast&amp;utm_source=jsjabber&amp;utm_campaign=devchat&amp;utm_content=homepage">Raygun</a>: <a href="https://raygun.com/?utm_medium=podcast&amp;utm_source=jsjabber&amp;utm_campaign=devchat&amp;utm_content=homepage">Raygun now offers Real User Monitoring of Core Web Vitals. Start your 14-day free trial now.</a> </li> <li> <a href="https://dexecure.com/javascriptjabberpodcast/">Dexecure</a>: <a href="https://dexecure.com/javascriptjabberpodcast/">Exclusive Offer For Javascript Jabber Listeners</a> Promo Code: DEXJSJAB </li> </ul> </div> Support this podcast at — https://redcircle.com/javascript-jabber/donations Advertising Inquiries: https://redcircle.com/brands Privacy & Opt-Out: https://redcircle.com/privacy