Wrong, my brother in code. I too once thought like you did. However, as evidenced by the table when comparing two things that are falsy, they are not always considered equal. This is what the article is about, the equality operator, not the things that truthy are or are not falsy. Sure the two falsy values null and undefined equal eachother. But the falsy value 0 does not equal null.
True, I guess you're right, when you let equality do coercions then things can get really ugly. That's why I said to always use the === so you don't have to deal with it, but as you pointed out, that was sort of the point of the table.
Do not make the same mistake as I did. I beg you. I would give the world to not have made those mistakes. Broken keyboards, missed deadlines and grey hairs are things that never leave the eye of the mind.
2
u/[deleted] Mar 26 '14
Wrong, my brother in code. I too once thought like you did. However, as evidenced by the table when comparing two things that are falsy, they are not always considered equal. This is what the article is about, the equality operator, not the things that truthy are or are not falsy.
Sure the two falsy values null and undefined equal eachother. But the falsy value 0 does not equal null.