我刚遇到这个
var strict = !! argStrict;
我不禁想知道,这是什么意思!!
?是双重否定的吗?似乎很多余php.js
,这种情况下的家伙不太可能会使用它吗?
它强制类型变为真正的布尔值,而不是“真实”值。例子:
var a = (1 === true) // comes out as false because 1 and true are different types and not exactly the same
var b = ((!!1) === true) // comes out as true because the 1 is first converted to a boolean value by means of negation (becomes false) and then negated a second time (becomes true)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句