!= operators do type coercion before comparing. This is bad because
' \f\r \n\t ' == 0 to be
true. This can mask type errors.
When comparing to any of the following values, always use the
operators, which do not do type coercion:
0 '' undefined null false true
If you want the type coercion, then use the short form. Instead of:
(foo != 0)
And instead of:
(foo == 0)
Use of the
!== operators is always preferred. There is a "Disallow
eqeqeq) option, which requires the use of
!== in all cases.