Intermediate JavaScript
Q43 / 100

What is a generator function?

Correct! Well done.

Incorrect.

The correct answer is B) A function using function* and yield that produces a sequence of values lazily via an iterator

B

Correct Answer

A function using function* and yield that produces a sequence of values lazily via an iterator

Explanation

function* gen() { yield 1; yield 2; } creates an iterator. Call gen().next() to get { value: 1, done: false }.

Progress
43/100