【发布时间】:2010-10-06 03:16:27
【问题描述】:
JavaScript 中的== 和=== 有什么区别?我也见过!= 和!== 运算符。这样的运营商还有吗?
【问题讨论】:
-
==是===类型转换(又名强制)。要真正理解我的意思,您可以查看这个行为与==完全相同的 JavaScript 函数:stackoverflow.com/a/38856418/984780 -
啊,是的,抽象相等运算符 (
==),也称为 if-same-type-then-strict-equality-comparison-otherwise-treat-null-and-undefined- and-document-dot-all-as-equal-but-if-string-involved-with-number-or-bigint-then-coerce-string-to-respective-numeric-type-but-if-boolean-involved-然后强制它到数字但是如果涉及对象然后强制它到原始和如果涉及数字类型然后比较他们的数字值与- distinct-infinities-and-nans-being-unequal-and-then-repeat-as-needed 运算符。
标签: javascript comparison-operators equality-operator identity-operator