Comparing values in javascript

This question already has an answer here:

  • Difference between == and === in JavaScript [duplicate] 2 answers

  • The difference between == and === is that the first one (double equals) does type coercion, which can lead to goofy results:

    0 == false
    true
    
    0 === false
    false
    

    It is usually recommended to use === as that will provide more predictable results and evaluate the true types of the values you're comparing.

    链接地址: http://www.djcxy.com/p/19440.html

    上一篇: “=”和“===”之间的Javascript差异

    下一篇: 在javascript中比较值