Programming · Flashcard

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

  • A=== compares value and type with no coercion; == coerces types first
  • B== compares value and type strictly; === also compares the memory address
  • C=== works only on numbers, while == works on all other data types
  • D== and === are identical; the extra sign is only a style preference

Why this is the answer

=== checks value and type with no coercion, while == coerces types first (0 == "0" is true, 0 === "0" is false). It's not reversed, neither compares memory addresses, === isn't limited to numbers, and the two aren't interchangeable.

Official docs
Study in Gnoseed →