1

Possible Duplicate:
Javascript === vs == : Does it matter which “equal” operator I use?

Not really relative to any type of code, just in general?

Community
  • 1
  • 1
nkcmr
  • 10,160
  • 25
  • 60
  • 81

3 Answers3

6

usually === also represents equality of type.

so:

   1 == "1" //true
   1 === "1" //false
Naftali
  • 142,114
  • 39
  • 237
  • 299
3

=== is the identical operator; it returns true when both the value and the type of the two operands are the same. == is the equal operator; it does not check types, just values.

Read more here.

Jon
  • 413,451
  • 75
  • 717
  • 787
1

=== compares the value as well as type of variable
== doesn't compare type

simshaun
  • 21,019
  • 1
  • 56
  • 73