Skip to content

Support for...of iteration #34

@memburg

Description

@memburg

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions