I have a jQuery for-each loop in an array and am wondering if it is possible to exit the loop earlier.
$ (lines) .each (function (i) {
// some code
if (condition) {
// I need something like break;
}
}); break; not really working for some reason.
If I wrote a for loop, it would look like this (but I don't want it):
for (i = 0; i <lines.length; i ++) {
// some code
if (condition) {
break; // leave the loop
}
}; Thanks in advance -Martin
source share