QuizNot attempted
Generators vs async/await
1–4 to choose, Enter to submit
Show answer & explanation
Correct answer:
- Calling a generator function runs its body immediately
- FALSE statement: calling a generator function does NOT run its body
- it only returns a paused iterator, and the body runs up to the first
yieldon the firstnext(). - The other three are true: values are computed lazily on demand, a finished generator keeps returning
{ value: undefined, done: true }and can't restart, and async/await is essentially generators that yield promises plus a runner (how co and early transpilers implemented it).