JS终止执行的实现方法
来源:懂视网
责编:小OO
时间:2020-11-27 20:29:14
JS终止执行的实现方法
(1)return。(2)return false。(二)非function方法里面。alert(";before error.";)。throw SyntaxError()。alert(";after error.";)。
导读(1)return。(2)return false。(二)非function方法里面。alert(";before error.";)。throw SyntaxError()。alert(";after error.";)。

(一)在function里面
(1)return;
(2)return false;
(二)非function方法里面
alert("before error.");
throw SyntaxError();
alert("after error.");
JS终止执行的实现方法
(1)return。(2)return false。(二)非function方法里面。alert(";before error.";)。throw SyntaxError()。alert(";after error.";)。