JS终止程序运行方法

1.return语句

js以函数的模式封装,在需要终止的地方以return语句返回

2.throw new error语句

在需要的地方以throw new error(“条件符合,程序终止”)结束程序。