Get in the habit of using the strict comparison operators (
Take this example:
'0' == 0; // Evaluates to true.
How is a string containing the character
0 equal to the integer zero? Because, when using
'0' === 0; // Evaluates to false.
That’s just one example of how automatic type conversion can get you into an unexpected and hard-to-debug situation. Using
!== will avoid such nonsense and always do what you expect.