+3 votes
85 views
asked in java script by (2.6k points)

What's the diff between "===" and "==" ? Thanks!

1 Answer

0 votes
answered by (2.3k points)

'===' means equality without type coersion. In other words, if using the triple equals, the values must be equal in type as well.

e.g.

0==false   // true
0===false  // false, because they are of a different type
1=="1"     // true, auto type coersion
1==="1"    // false, because they are of a different type

Source: http://longgoldenears.blogspot.com/2007/09/triple-equals-in-javascript.html

Categories

...