How jquery does array traversal jumps out of the current each loop _jquery
Source: Internet
Author: User
Recently busy in the official website revision, in doing one of the projects encountered a small problem. The problem is that the array traversal is done through the jquery loop, but how to jump out of the current loop when the condition is not met.
I used $.each () to iterate through the array, but when I entered the judgment, I was not sure how to jump out of the current loop, so I used the JavaScript method to--continue that it was not correct. The instructions on the API only jump out of the loop (if you need to exit each loop so that the callback function returns false, the other return values are ignored). )
Later on the internet to check, got the result:
Return false;--out of all loops, equivalent to the break effect in JavaScript.
Return true;--out of the current loop and into the next loop, equivalent to the continue effect in JavaScript.
PS: To share with kids who are just starting to learn jquery.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.