0%

1201-双等和全等区别

1、字符串和数字比较

  1. 如果type(x)是数字,type(y)是字符串,则返回x==toNumber(y)的结果。
  2. 如果type(x)是字符串,type(y)是数字,则返回toNumber(x)==y的结果。

2、数字和布尔值比较

  1. 如果type(y)是布尔值,则返回x==toNumber(y)的结果。
  2. 如果type(x)是布尔值,则返回toNumber(x)==y的结果。
console.log(undefined==null) //true
console.log(undefined===null) //false