<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>anonytrary</author><text>One thing I dislike about the iterator protocol is that it creates garbage around every value you&amp;#x27;re iterating over:&lt;p&gt;&lt;pre&gt;&lt;code&gt;  let set = new Set([1,2,3]), it = set.values(), n;
  while(!(n = it.next()).done) console.log(n);
  &amp;#x2F;&amp;#x2F; {value: 1, done: false}
  &amp;#x2F;&amp;#x2F; {value: 2, done: false}
  &amp;#x2F;&amp;#x2F; {value: 3, done: false}
&lt;/code&gt;&lt;/pre&gt;
I found this strange considering javascript has symbols now. Symbols would be perfect for the iterator protocol:&lt;p&gt;&lt;pre&gt;&lt;code&gt;  while((n = it.next()) !== Symbol.iteratorDone) console.log(n)
  &amp;#x2F;&amp;#x2F; 1
  &amp;#x2F;&amp;#x2F; 2
  &amp;#x2F;&amp;#x2F; 3
&lt;/code&gt;&lt;/pre&gt;
Not that this is too much of an issue, I&amp;#x27;m sure using yield&amp;#x2F;yield*&amp;#x2F;of will eventually optimize this.</text><parent_chain></parent_chain></comment><story><title>JavaScript iterator patterns</title><url>https://loige.co/javascript-iterator-patterns</url></story>
<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>jondubois</author><text>Iterators and generators are powerful and can make code much cleaner&amp;#x2F;more declarative. Especially when used with async&amp;#x2F;await.&lt;p&gt;If anyone is interested, I recently released a real-time WebSocket library (Node.js and front end) which only uses Async Iterators to stream data (no event listener callbacks):&lt;p&gt;&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;hackernoon.com&amp;#x2F;getting-started-with-asyngular-bbe3dd1c716c&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;hackernoon.com&amp;#x2F;getting-started-with-asyngular-bbe3dd...&lt;/a&gt;&lt;p&gt;Feedback welcome.</text><parent_chain></parent_chain></comment><story><title>JavaScript iterator patterns</title><url>https://loige.co/javascript-iterator-patterns</url></story>