Javascript and yield function | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

Javascript and yield function

Yield seems a very interesting function, but I'm not able and google a good tutorial about. Do you know any?

12th Jan 2019, 1:01 PM
Paolo De Nictolis
Paolo De Nictolis - avatar
4 Answers
+ 3
Simple example of generator function and yield. https://code.sololearn.com/WEP8xjkisaQK/?ref=app Some applications, get delay value and values fromlong period execution function. https://code.sololearn.com/Wyx4w0yUd6o3/?ref=app https://code.sololearn.com/W6lVuoEhh83x/?ref=app
12th Jan 2019, 1:39 PM
Calviղ
Calviղ - avatar
12th Jan 2019, 5:36 PM
VEDANG
VEDANG - avatar
+ 6
The MDN web docs have a pretty decent example of what yield does. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/yield The description is also pretty on point. It's like a return statement for a function, but instead for a generator where you can 'yield' more than one value.
12th Jan 2019, 1:09 PM
Hatsy Rei
Hatsy Rei - avatar
+ 4
I knew MDN article. Thanks to Calvin for its code. Anything else?
12th Jan 2019, 3:48 PM
Paolo De Nictolis
Paolo De Nictolis - avatar