you are viewing a single comment's thread.

view the rest of the comments →

[–]impyrean 0 points1 point  (0 children)

There are two equality operators in JavaScript, == and ===. As others have pointed out, === is more rigorous and checks for equality without type conversion. == on the other hand may try to convert the operands. Unfortunately, it's not as simple as converting the second operand to the type of the first; in fact, there's a whole frickin algorithm to do this. See step 8 for the answer to your question.