How to skip to next iteration in jQuery.each() util?

What they mean by non-false is:

return true;

So this code:

var arr = ["one", "two", "three", "four", "five"];
$.each(arr, function(i) {
  if (arr[i] == 'three') {
    return true;
  }
  console.log(arr[i]);
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

will log one, two, four, five.

Leave a Comment