Skip to content

QuizNot attempted

Generators vs async/await

Which statement about generators is FALSE?
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 yield on the first next().
  • 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).