1. If you terminate a Return of a function, for example, as follows:
Function testa () {)
alert ('a');
alert ('b');
alert ('c');
}
testa (); The program execution will pop up 'a', 'b', 'c'.
Function testa () {)
alert ('a');
Return;
alert ('b');
alert ('c');
}
testa (); The program executes the pop -up 'a' will end.
2. Call other functions in the function. The function that is also hoped to call is terminated while the calling function is terminated. For example,
Function testc () {
alert ('c');
Return;
alert ('cc');
}
Function testd () {
testc ();
alert ('d');
}
testd (); We see that Testc is called in testd, and in Testc, he wants to terminate Testd through Return. It is only time to stop Testc and the wish of Return. The program execution will pop up 'C', 'D'.
Function testc () {
alert ('c');
Return false;
alert ('cc');
}
Function testd () {
if (! testc ()) Return;
alert ('d');
}
Testd (); The two functions are modified, and the false is returned in the testc. The return value of testc is judged in TESTD. In this way, TESTD can be terminated while termination.