Open goldEli opened 4 years ago
let a = 3;
let b = new Number(3);
let c = 3;
// true , 隐式类型转换
console.log(a == b);
// false , new Number() 返回包装过的实例对象,非原始类型数据
console.log(a === b);
// false , 同上
console.log(b === c);
let a = 3;
let b = new Number(3);
let c = 3;
console.log(a == b); // true 进行了转换
console.log(a === b);// false new Number(3) 并不是一个 number 类型,而是一个 object
console.log(b === c);// false 同上
new Number(3).toString()
// '3'
'3' === 3
//false