console.log(undefined !== null);//true
console.log(undefined == null);//true
我无法理解为什么 undefined !==null,但我知道 undefined == null,因为语言规范 explicitly says :
If x is null and y is undefined, return true
最佳答案
您在第一个比较中使用严格相等,而在后者中使用非严格相等。您会发现 undefined === null
正如预期的那样是 false
。
关于javascript - 在 javascript 中,为什么 null !== undefined 是 true,但是 null == undefined 也是 true?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44688719/