When I first started learning and writing JavaScript, the recommendation I came across again and again was that the equality operator, ==
, or “double-equals” was the devil incarnate. You should always use the identity operator, ===
, or “triple-equals” because then you won’t have to battle weird type coercion bugs (and remember it’s not necessarily the time you write the original code that you’ll get tripped up, it’s the time you maintain it for the nth time). […]
OK, put this one in the completely weird bucket. It works, but damn it’s obscure. […]
READ MORE