Appropriate usage of == and === in JavaScript

This question already has an answer here:

  • Which equals operator (== vs ===) should be used in JavaScript comparisons? 50 answers
  • Difference between == and === in JavaScript [duplicate] 2 answers

  • The == operator means equality after type conversion

    1 == '1';  // true
    1 == 1;    // true
    

    The === operator means equality without any conversion

    1 === '1'; // false
    1 === 1;   // true
    
    链接地址: http://www.djcxy.com/p/19434.html

    上一篇: javascript奇怪的比较字符串

    下一篇: 在JavaScript中适当使用==和===