Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

== 和 ===、以及 Object. is 的区别 #31

Open
Hongbusi opened this issue Jul 8, 2022 · 0 comments
Open

== 和 ===、以及 Object. is 的区别 #31

Hongbusi opened this issue Jul 8, 2022 · 0 comments
Labels
JS javascript today 每日一题。

Comments

@Hongbusi
Copy link
Member

Hongbusi commented Jul 8, 2022

在这里引用一下 MDN 里面的解释:

  • Object.is()== 不同。== 运算符在判断相等前对两边的变量(如果它们不是同一类型)进行强制转换(这种行为将 "" == false 判断为 true),而 Object.is 不会强制转换两边的值。
  • Object.is()=== 也不相同。差别是它们对待有符号的零和 NaN 不同,例如,=== 运算符(也包括 == 运算符)将数字 -0+0 视为相等,而将 Number.NaNNaN 视为不相等。
@Hongbusi Hongbusi added today 每日一题。 JS javascript labels Jul 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
JS javascript today 每日一题。
Development

No branches or pull requests

1 participant