<分区>
Possible Duplicate:
What is the !! operator in JavaScript?
什么是 not not in javascript 我已经看过几次了:)
function foo(){
return !!(window.history);
}
<分区>
Possible Duplicate:
What is the !! operator in JavaScript?
什么是 not not in javascript 我已经看过几次了:)
function foo(){
return !!(window.history);
}
最佳答案
我相信它用于强制执行 bool 类型...
例如
if("true" == true){
alert("1");
}else{
if(!!"true" == true){
alert("2");
}
}
警报 2 而不是 1
关于javascript:什么是 NOT NOT? (!! 运算符(operator) ),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5404701/