Re:What does `return function *(){…}` mean in JavaScript?
by bdfh42 on Thursday November 07, 2013 @06:58AM
(#6688878)
But jump to this http://wingolog.org/archives/2013/05/08/generators-in-v8 which explains it properly - and tells you why you would want to do it.
[ Parent
| on HN ]
Re:What does `return function *(){…}` mean in JavaScript?
by k__ on Thursday November 07, 2013 @08:17AM
(#6689103)
Does it need to be used with promises?
Re:What does `return function *(){…}` mean in JavaScript?
by apaprocki on Thursday November 07, 2013 @08:42AM
(#6689211)
No. Promises work nicely with generators, but you can use generator functions freely.
Re:What does `return function *(){…}` mean in JavaScript?
by k__ on Thursday November 07, 2013 @08:57AM
(#6689278)
Is there any promise-less guide, that helps to grasp the concept of function* and yield in JS?
Re:What does `return function *(){…}` mean in JavaScript?
by masklinn on Thursday November 07, 2013 @11:36AM
(#6690348)
Any generator guide for Python will work, the syntax is slightly different (no function/def, the generator is "created" by the presence of a `yield` keyword in the body, and `yield*` is called `yield from`)
Re:What does `return function *(){…}` mean in JavaScript?
by k__ on Friday November 08, 2013 @09:59AM
(#6696379)
The easiest thing to do is probably playing around with it :)