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

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

The “==” operator is used for simple comparison. This only checks the value on both sides. Whereas “===” is used for strict comparison. This not only checks the value on both sides but also their data type.

Eg:     2 == “2” ;    This return true as both values are 2.
2 === “2” ;    This returns false. Both values are 2 but both represent different data types.

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.