DEV Community

Discussion on: JavaScript: what are generators (yield)

Collapse
 
darkwiiplayer profile image
𒎏Wii 🏳️‍⚧️

You quote one possible meaning of yield, but it is actually the wrong one. A second meaning of this word:

to relinquish one's possession of (something, such as a position of advantage or point of superiority)

This is what it's actually about. When you yield, you give up the CPU so another thread of execution can run instead. It's the one and only mechanism for cooperative multithreading: a thread runs until it decides to let another one run for a while.

Also, at the end, instead of "fonts" it should be "sources" :D

Collapse
 
evelynstender profile image
Evelyn Stender

Thank you so much! I'll update!!