Home > Article > Web Front-end > What are the ending methods in javascript?
The ending methods are: 1. In function, "return;" and "return false;"; 2. In non-function method, "alert("statement");" and "throw SyntaxError() ;".
The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.
The main execution sequence of the js method is to run from top to bottom. The method to terminate the js method and no longer continue to run downward is as follows:
(1) In the function
(1) return;
(2) return false;
(2) In the non-function method
alert(“before error.”);
throw SyntaxError();
alert(“after error.”);
[Recommended learning: javascript advanced tutorial]
The above is the detailed content of What are the ending methods in javascript?. For more information, please follow other related articles on the PHP Chinese website!