for...of Loop

noun

say it: “FOR OV LOOP” /fɔːr ʌv luːp/

A JavaScript loop that hands you each value of an array (or other list of values) in turn, without a counter or index to manage.

What is for...of Loop in JavaScript?

for...of Loop — A loop that visits the values produced by an iterable.

for (const pet of pets) {
    petNames.push(pet.name);
}

In a sentence

  • “With a for...of loop I added up every song length without writing a single index.”

Level: Apprentice · More JavaScript terms at this level

Updated