Javascript 布尔参数未正确传递
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10841737/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-24 03:11:07 来源:igfitidea点击:
boolean argument not passing correctly
提问by user701254
I'm new to jQuery and im just trying to pass a boolean to a function.Ive tried various amendments but still not working ?
我是 jQuery 的新手,我只是想将一个布尔值传递给一个函数。我尝试了各种修改,但仍然无法正常工作?
I'm expecting the alert to be fired
我期待警报被触发
isTrue(true);
function isTrue(boolean isNot){
if(isNot){
alert('true');
}
}
回答by Joseph
JavaScript (not Java) has no type indicators, just variable names. Remove boolean
JavaScript(不是 Java)没有类型指示器,只有变量名。消除boolean
function isTrue(isNot){
if(isNot){
alert('true');
}
}