Skip to content
This repository has been archived by the owner on May 7, 2023. It is now read-only.

Latest commit

 

History

History
19 lines (11 loc) · 803 Bytes

double-vs-triple-equals.md

File metadata and controls

19 lines (11 loc) · 803 Bytes

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

Answer

Triple equals (===) checks for strict equality, which means both the type and value must be the same. Double equals (==) on the other hand first performs type coercion so that both operands are of the same type and then applies strict comparison.

Good to hear

  • Whenever possible, use triple equals to test equality because loose equality == can have unintuitive results.
  • Type coercion means the values are converted into the same type.
  • Mention of falsy values and their comparison.
Additional links