WHAT
javascript
「严格值比较」:===
java
「抽象值比较」或自动转换比较:==
ide
==先转换类型再比较,===先判断类型,若是不是同一类型直接为false。
.net
「严比」是类型和值都进行比较,「抽象比较」则比较的是抽象语义,例如空串与0的语义类似,可当作相等
3d
JavaScript has both strict and type–converting comparisons. A strict comparison (e.g., ===) is only true if the operands are of the same type and the contents match. The more commonly-used abstract comparison (e.g. ==) converts the operands to the same type before making the comparison.
cdn
For relational abstract comparisons (e.g., <=), the operands are first converted to primitives, then to the same type, before comparison.
htm
个人建议是:若是你的的确确知道你在作什么(了解类型转换的结果),能够用==;不然仍是用===吧。
blog
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operatorsip
https://stackoverflow.com/questions/5447024/javascript-comparison-operators-identity-vs-equality
it
JavaScript中三个等号和两个等号你了解多少
https://www.jb51.net/article/117815.htm
大部分状况下,你仍是可继续三等号,除非很是特殊的须要,才考虑使用Object.is()
《U ES6》