如果条件不成立,我想要方法来防止代码恢复他正在做的事情。
这是我的代码
function doSomething{
if(1==2){
alert("Can I access to your event?");
}else{
//1 not equals 2, so please die
// I tried die() event; It worked, But i get this error in the console
// Uncaught TypeError: Cannot call method 'die' of undefined
}
}
$(".foo").click(function(){
doSomething();
alert("welcome, 1 == 1 is true");
}