for...of
Iterates over each element of an array.
Syntax
for (const e of arr) { ... }Description
A modern way to iterate directly over elements without dealing with indices.
Example
Loading editor…
Expected output
red purple
When to use?
Processing array/text elements sequentially.