Skip to content Skip to sidebar Skip to footer

Difference Between "==" And "===" In Java Script

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.

Solution 1:

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

Post a Comment for "Difference Between "==" And "===" In Java Script"