+ 3

JS yield - what is it and what do it ?

I will appreciate a good explanation about it...

27th Oct 2019, 5:55 PM
Oneill~Онеилл~奥尼尔~ओनील~اونیل~*‎
Oneill~Онеилл~奥尼尔~ओनील~اونیل~*‎ - avatar
3 Antworten
+ 3
Okay, so the * makes the function a generator function: it returns an iterator, which is an object, that has a value, done value and a next method. yield stops the function "execution", and returns the value after it. Giving an argument to the next method will replace the yield statement with that value. So, y will be 7.
27th Oct 2019, 6:23 PM
Airree
Airree - avatar
- 1
How can I change the language to german?
30th Oct 2019, 11:13 PM
Pro 100 xd
Pro 100 xd - avatar