!1 和 !0 在 Javascript 中是什么意思?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11550681/
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
What does !1 and !0 mean in Javascript?
提问by m_vdbeek
Possible Duplicate:
return !1 in javascript
可能的重复:
在 javascript 中返回 !1
In a JavaScript file I had to read today, there was a line where a variable was declared like a factorial, like this :
在我今天必须阅读的 JavaScript 文件中,有一行声明变量像阶乘一样,如下所示:
var myVariable = !1;
and then something similar was used as parameter in a function like this :
然后类似的东西被用作这样的函数中的参数:
return variable.myFunction(!0);
Can anyone explain me what the exclamation mark means in this context and eventually, why this is generally used for (benefits) ?
谁能解释一下感叹号在这种情况下的含义,并最终解释为什么这通常用于(好处)?
Thank you in advance !
先感谢您 !