Difference between == and ===?

  • ==loose equality, converts data types before comparison.
  • ===strict equality, checks value and type.

Example:

console.log(5 == "5");  // true  (type conversion)
console.log(5 === "5"); // false (strict check)

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *