+ 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?
4 ответов
+ 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
+ 10
Other than MDN you can also visit:
https://medium.com/dailyjs/a-simple-guide-to-understanding-javascript-es6-generators-d1c350551950
+ 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.
+ 4
I knew MDN article. Thanks to Calvin for its code. Anything else?