The difference between == and === in JS

Possible duplicates:
Difference between == and === in JavaScript
Javascript === vs ==: Does it matter which "equal" operator I use?

What is the difference between == and === ? Also between !== and !== ?

+8
javascript equality-operator identity-operator comparison-operators
source share
2 answers

There are already many answers to this question in Stackoverflow.

Short:

== compares only values

=== compares values ​​+ type


 var check1 = '10', check2 = 10; check1 == check2 // true check1 === check2 // false 
+30
source share

"==" means equals, while "===" means identically equal.

In short, "==" will try and force / convert value types when comparing, so "2" == 2, while "===" will not.

0
source share

All Articles