Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

For-of loop

const arr = [1, 2, 3, 4, 5];

// Long-hand
for (let i = 0; i < arr.length; i++) {
  const element = arr[i];
  // ...
}

// Short-hand
for (const element of arr) {
  // ...
}
Source by dev.to #
 
PREVIOUS NEXT
Tagged: #loop
ADD COMMENT
Topic
Name
5+7 =