Previous: forin, Up: Iterators---For--Of [Index]
The for...of
statement creates a loop iterating over iterable objects,
including:
It invokes a custom iteration hook with statements to be executed for the value of each distinct property of the object.
for (const [key, value] of iterable) ...
In for...of
loops, abrupt iteration termination can be caused by break
,
throw
or return
. In these cases, the iterator is closed.
You can also iterate over generators, i.e. functions generating an iterable object.