JavaScript termination functions perform operations

Source: Internet
Author: User

  This article is mainly on the JavaScript termination function of the operation of the method is introduced, the need for friends can come to the reference, I hope to be helpful to everyone

1. If you terminate the return of a function, the example is as follows: Function Testa () {    alert (' a ');     alert (' B ');     alert (' C ') ; } testa (); Program execution will pop up ' a ', ' B ', ' C ' in turn.   Function Testa () {    alert (' a ');     return;     alert (' B ');     alert (' C ') ); } testa (); The execution of the program popup ' a ' will terminate.   2, call another function in the function to terminate the call function and also want to call the function terminated, the instance is as follows: function TESTC () {    alert (' C ');     return;     Alert (' CC '); }   function testd () {    TESTC ();     alert (' d ');} testd (); We saw in the TESTD called the TESTC, in the TESTC want to return to the TESTD also terminated, the contrary is only terminated TESTC, the program execution will pop up ' C ', ' d '.   function Testc () {    alert (' C ');     return false;     alert (' CC ');}   Functio n testd () {    if (!TESTC ()) return;     alert (' d ');} testd (); Two functions have been modified, TESTC return FALSE,TESTD in the return value of TESTC to make a judgment, so that the termination of the TESTC can also terminate the TESTD, program execution pop-up ' C ' will terminate.        

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.