spaasteam / spaas-daily-practice

spaas团队的每日一练,欢迎小伙伴们提交踊跃答案!
4 stars 2 forks source link

第 70 题: 写出你所能想到的所有方法来阻止后续代码执行 #87

Open linrunzheng opened 5 years ago

linrunzheng commented 5 years ago
console.log(1)

在这里插入代码,阻止后续代码执行,方法不限

console.log(2)
Jack-rainbow commented 5 years ago
console.log(1)

// return false;
// return;
// throw new Error();

console.log(2)
cjfff commented 5 years ago
console.log(1)

// hello 不存在的变量
// throw new Error('error')
// 语法错误 import 等等不合法的语法

console.log(2)
Htongbing commented 5 years ago
console.log(1)
while (1) {}
console.log(2)

console.log(1)
for (;;) {}
console.log(2)

console.log(1)
throw new Error()
console.log(2)

console.log(1)
function a() {
  a()
}
a()
console.log(2)