JavaScript
Article

jquery (js) skip out of each loop

By Sam Deering

Quick JavaScript snippet to skip out of each loop. Returning true skips to the next iteration, equivalent to a continue in a normal loop.

..inside loop such as foreach, $.each or .each etc...
if (condition){
   return false
}
....

No Reader comments

Recommended

Learn Coding Online
Learn Web Development

Start learning web development and design for free with SitePoint Premium!

Get the latest in JavaScript, once a week, for free.