对于Object,==与===是没有区别的,都是对引用地址进行比较
function checkAge(data) { if (data === { age: 18 }) { console.log(1) } else if (data == { age: 18 }) { console.log(2) } else { console.log(3) } } console.log(checkAge({ age: 18 })) //3
原文:https://www.cnblogs.com/lianglanlan/p/14392152.html