
for…of Loop – Iterates over **iterable values** (arrays, strings, NodeLists). Cleaner than a for‑loop when you don't need the index.
๐ Syntax
for (const value of iterable) {
// value is each element
}
๐งช Example
const colors = ['red', 'green', 'blue'];
for (const c of colors) {
console.log(c.toUpperCase());
}
Comments
Post a Comment