Open Hongbusi opened 2 years ago
在这里引用一下 MDN 里面的解释:
Object.is()
==
"" == false
true
Object.is
===
NaN
-0
+0
Number.NaN
在这里引用一下 MDN 里面的解释:
Object.is()
与==
不同。==
运算符在判断相等前对两边的变量(如果它们不是同一类型)进行强制转换(这种行为将"" == false
判断为true
),而Object.is
不会强制转换两边的值。Object.is()
与===
也不相同。差别是它们对待有符号的零和NaN
不同,例如,===
运算符(也包括==
运算符)将数字-0
和+0
视为相等,而将Number.NaN
与NaN
视为不相等。