js中的终止当前方法

js方法主要执行顺序是自上而下依次运行的,终止js方法不再继续向下运行方法如下:
(一)在function里面

(1)return;
(2)return false;

(二)非function方法里面

alert(“before error.”);
throw SyntaxError();
alert(“after error.”);

原文地址:https://www.cnblogs.com/wanlige/p/14276134.html