14

What is the difference between "==" and "===" in JavaScript?

Comments
  • 7
    I usually ask this at interviews. So many 'senior' developers that don't know the difference
  • 12
    Answer: there is one more =
  • 0
    I got this one recently.
  • 1
    == will return true if you are comparing 1 to "1", === will not
  • 4
    One is scary, the other is sane.
  • 2
    @kaqqao I guess the big issue is that we live in a world where this is a reasonable question, which would imply that people fire away their applications like tommy guns without actually knowing shit.
  • 4
    == equals
    === very equals
  • 1
    @DLMousey and so `===` is faster and cleaner because it won't cast any of the operands before comparing.

    ..just wanted to add that.😪
  • 0
    @MaxDeepfield the exact way I like to describe it! Well done sir.
Add Comment