JS Basic Tutorial
The for...of
loop is used to iterate over iterable objects, such as arrays, strings, maps, sets, and more. It directly provides the values of the iterable.
for (element of iterable) { // Code to execute for each element }
element
: A variable that stores the value of the current item in the iteration.iterable
: An object that can be iterated (e.g., an array, string, or other iterable).Try it yourself
Try it yourself