1.

Explain The Difference Between == And === ?

Answer»

The 3 equal signs mean "equality without type COERCION". Using the TRIPLE equals, the values must be equal in type as WELL

  • == is equal to 
  • === is EXACTLY equal to (value and type)
  • 0==false // true 
  • 0===false // false, because they are of a different type
  • 1=="1" // true, auto type coercion
  • 1==="1" // false, because they are of a different type

The 3 equal signs mean "equality without type coercion". Using the triple equals, the values must be equal in type as well. 



Discussion

No Comment Found