Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
为什么是
console.log('' == false); //true
但
console.log('' === false); //false
基于此,最后一行应该返回 true,对吗?
因为===检查类型并且字符串是字符串,而 false 是布尔值。
===
不,当您===在 javascript 中使用时,您也在比较type,请参阅这篇更详细解释的文章。