0

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

Hi I am not clear why there are two == and === comparator operators in java script.

Community
  • 1
  • 1
giri
  • 26,063
  • 61
  • 139
  • 176

1 Answers1

5

The equality operator == coerces, or converts the data type temporarily to see if it's equal to the other operand whereas the identity operator === doesn't need to do any converting whatsoever since it directly compares them without conversion meaning it's stricter and faster.

2=='2'
true

2==='2'
false
meder omuraliev
  • 177,923
  • 69
  • 381
  • 426