View Single Post
  #2 (permalink)  
Old 10-05-2005, 02:28 PM
KevinH KevinH is offline
Zimbra Employee
 
Posts: 4,792
Default

The === and !== are identity compares (ie check that things are identical without tye conversion) Some more detail below.






From: http://www.crockford.com/javascript/lint.html



The == and != operators do type coercion before comparing. This is bad because it causes '' == 0 to be true. This can mask type errors.

When comparing to any of the following values, use the === or !== 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)
just say
(foo)
and instead of
(foo == 0)
say
(!foo)
Reply With Quote