所以假设我想让代码停止。
var test = "good";
if (test === "good") {
alert("The test is good");
}
else if (test ==="bad") {
alert("Oh no, the test went bad!");
我放在这里做什么,这样如果测试不好,代码将完全停止,并且不会提醒您通过测试
}
alert("You've passed the test");
同样,这是一个示例,不是我正在从事的实际项目,但我该怎么办?
尝试exit();
这应该适合您。