Summary
Add support for for...of loops to iterate over arrays and strings.
Motivation
for...of is the standard modern iteration pattern in JavaScript. The runtime already has iterable collections (arrays, strings) and a for-loop infrastructure — this is a natural next step.
Scope
- Iterate over array elements:
for (var x of [1, 2, 3]) { ... }
- Iterate over string characters:
for (var ch of "hello") { ... }
break/continue support inside for...of
- Variable declaration via
var in the loop head
Out of scope
for...in (property enumeration — different semantics)
- Custom iterables /
Symbol.iterator protocol
let/const declarations
Summary
Add support for
for...ofloops to iterate over arrays and strings.Motivation
for...ofis the standard modern iteration pattern in JavaScript. The runtime already has iterable collections (arrays, strings) and afor-loop infrastructure — this is a natural next step.Scope
for (var x of [1, 2, 3]) { ... }for (var ch of "hello") { ... }break/continuesupport insidefor...ofvarin the loop headOut of scope
for...in(property enumeration — different semantics)Symbol.iteratorprotocollet/constdeclarations