Skip to content
All lessons

Tech Insights· gomakethings.com

JavaScript’s forEach loops don’t have continue, you can achieve the same result by using return

From gomakethings.com

On Monday, we looked at how to use a for loop to iterate through arrays and NodeLists. Today, we’re going to look at how ES6 forEach() methods make it even easier. TheArray.forEach() ES6 introduced the Array.forEach() method for looping through arrays. You call this method on your array, and pass in a callback function to run on each iteration of the loop. The callback accepts two arguments. The first is the value of the current item in the loop, and the second is the index of that item.

Shared by

Read on gomakethings.com

Book a call

Lessons like this one
shape how we build.

Tell us what you’re building. In one call, we’ll show you how our team would approach it.

Tell us what you’re building, and we’ll show you how we’d approach it.

Still prefer the good old email? Contact us