Exit and continue the next loop in js and jquery-javascript tips-js tutorial

Source: Internet
Author: User
Exit the loop, use break; exit the current loop and continue the next loop. Use continue, use returnfalse in jquery, and use returntrue as the goods, that is, you have learned to record 1 + 1 = 3! Error: 2

Learning records:

In js

For (var I = 1; I <5; I ++) {if (I = 3) {break; // when break is used, 2 prompts are displayed, 1, and 2; if you use continue, it will pop up three times, namely 1, 2, 4} alert (I );}

Loop, exit the loop, use break; exit the current loop to continue the next loop, use continue

To implement break in the each () method in jquery, use return false; continue, use return true

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.