jQuery each() function allows us to loop through different datasets such as arrays or objects. jQuery.each() is one of the most used functions in jQuery.
$(selector).each(function(index, element)) $.each(function(index))
$.each() is essentially a drop-in replacement of a traditional for or for..in loop.
Example 1: This example skipping step 4 to next iteration i.e. Step 5.
Step1 Step2 Step3 Step5
Explanation: In the above code, you can see that when the iteration comes at “i=4” then the “if” condition becomes “true” that returns a non-false value. So it skips the next iteration i.e. Step 4.
1 2 4 5