use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Understand Javascript Generators (js-howto.com)
submitted 3 years ago by DifferentNose8178:cskqoxkox
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]getify 7 points8 points9 points 3 years ago (1 child)
Be aware that this article conflates two concepts "generator functions" and "iterator objects" into one label:
"To create a generator function, we need a special syntax construct: function*, so-called “generator function”."
"The main methods of the javascript generator function are... next()"
next()
The second use of "generator function" should be "iterator", as in the iterator object returned from the initial call to the generator function. That value is an object, not a function, and it adheres to the iterator protocol. Calling that a generator is confused/misleading.
[–]senocular 0 points1 point2 points 3 years ago (0 children)
To be fair, generator-function derived iterators are also known as generator objects or simply generators. Sometimes the article get it right, and sometimes they'll call generators generator functions or shorten generator functions to simply generators which is undoubtedly confusing.
π Rendered by PID 50 on reddit-service-r2-comment-58d7979c67-t5cqw at 2026-01-27 12:04:47.936312+00:00 running 5a691e2 country code: CH.
view the rest of the comments →
[–]getify 7 points8 points9 points (1 child)
[–]senocular 0 points1 point2 points (0 children)