I have an .each loop in jQuery.
I want to iterate the loop one time less. i.e if 4 elements are found matching, than the loop should iterate only 3 times.
PS: Not using var i and i++ etc. But actually looping 1 less.
Use the .slice( <start>, <end> ) method (negative end = offset relative to the end):
$(some_object).slice(0, -1).each( ... );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With