Skip to content
CodeWiki
Practice
Paths
Tracks
Cheatsheets
Playground
Glossary
AI era
Search
⌘K
English
English
Chinese
Practice
Paths
Tracks
Cheatsheets
Playground
Glossary
AI era
English
English
Chinese
Practice
/
Quiz
/
JavaScript
/
Iterators and generators
What happens when break leaves a for...of loop before its generator finishes?
from Iterators and generators
Node 24
intermediate
1 min
What happens when break leaves a for...of loop before its generator finishes?
The loop calls the iterator return method, allowing a surrounding finally block to run.
The loop waits for garbage collection to run the generator finally block.
The generator restarts and consumes its remaining values in the background.
The loop converts every remaining value into an array before exiting.
Check
Ask AI about this kata
Report an error
next kata
Which implementation gives a collection independent repeatable traversals?
Quiz
A new version is available
Reload