Statements

for...of statement

Try the free JavaScript compiler

Obtains an iterator and consumes its values. The body runs for each yielded value; early exit invokes iterator closing where required. It differs from property-name enumeration.

Formal Syntax & Structure

javascript syntaxjavascript
for (const value of iterable) { … }

Working Example

Example Snippetjavascript
for(const v of [3,7])console.log(v);
JavaScript Reference