Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/477.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何使用!!表情?_Javascript - Fatal编程技术网

Javascript 如何使用!!表情?

Javascript 如何使用!!表情?,javascript,Javascript,可能重复: 我发现js代码是这样写的:!!未定义!!虚假的 jquery源代码(jquery 1.7.0.js:第748行): grep:function(元素、回调、inv){ var ret=[],retVal; inv=!!inv; //遍历数组,只保存项目 //通过验证器函数的 对于(var i=0,length=elems.length;i

可能重复:

我发现js代码是这样写的:!!未定义!!虚假的

jquery源代码(jquery 1.7.0.js:第748行):

grep:function(元素、回调、inv){
var ret=[],retVal;
inv=!!inv;
//遍历数组,只保存项目
//通过验证器函数的
对于(var i=0,length=elems.length;i
这是一种将非布尔对象转换为布尔对象的简写方法


例如!!0将转换为false。

这是将非布尔对象转换为布尔对象的简写方法


例如!!0将转换为false。

其简单的双重否定用于将任何数据类型(null、未定义、对象)强制为boolean


其简单的双重否定用于将任何数据类型(null、未定义、对象)强制为布尔值


表示<代码>相反

所以
表示双对向

在这种情况下,它也常用于:

var check = !!(window.something && window.runthis)
//If something exists and runthis exists, then
//check = true

//If one of them is not exist, then
//check = false

常用于。

表示<代码>相反

所以
表示双对向

在这种情况下,它也常用于:

var check = !!(window.something && window.runthis)
//If something exists and runthis exists, then
//check = true

//If one of them is not exist, then
//check = false

常用于。

嗯,确实如此。
!expr
do?什么是
!(!expr)
do?把这些小部分放在一个更大的部分:)可能的重复,更具体地说,那就是
!expr
do?什么是
!(!expr)
do?把小部分放在一个更大的部分:)更具体地说,可能是