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, the call function is terminated while 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 ');
}
Function testd () {
if (!TESTC ()) return;
alert (' d ');
}
Testd (), two functions have been modified, TESTC returned in FALSE,TESTD to the TESTC return value, so that the termination of TESTC can also terminate the TESTD, program execution pop-up ' C ' will terminate.