How do I go to the next iteration of a JavaScript Array.forEach() loop?

For example:

var myArr = [1, 2, 3, 4];

myArr.forEach(function(elem){
  if (elem === 3) {
    // Go to "next" iteration. Or "continue" to next iteration...
  }

  console.log(elem);
});

MDN docs only mention breaking out of the loop entirely, not moving to next iteration.

3 Answers
3

Leave a Reply

Your email address will not be published. Required fields are marked *