终止执行js的方法

(一)在function里面

(1)return;
(2)return false;

(二)非function方法里面

alert("before error.");
throw SyntaxError();
alert("after error.");

以上就是小编为大家带来的JS 终止执行的实现方法全部内容了,希望大家多多支持脚本之家~

原文地址:https://www.cnblogs.com/dzhou/p/9849862.html