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》