JavaScript Developer — Medium
Key points
- The spread operator (...) is used to convert the generator into an array
- Only yielded values are included in the array, not the returned value
- The generator function stops at the return statement
- The correct answer is [1, 2], as it includes the yielded values
Ready to go further?
Related questions
