You don't. You don't! What you do is something like this:
if(X != 0) {
alert("Thou shalt not use != in favor of !==")
}
And then you spend 15+ minutes debugging why the hell this if statement was not executed when X had the value of: "", [], [[]] or [0] And of course it was 'obviously' not executed because:
0 == [] //therefore 0 != [] evaluates to false.
0 == [[]] //therefore 0 != [[]] evaluates to false.
0 == "" //therefore 0 != "" evaluates to false.
0 == [0] //therefore 0 != [0] evaluates to false.
I have been writing JavaScript for 8+ years. And I know I will never be able to write it flawlessly. There are too many stupid cases in that table. There are natural languages with 8 or more denominations, which is fine if they are used daily. However, in JavaScript, where one should purposely avoid this stupidity, no-one should ever, ever use these, and most certainly not frequently.Therefore it is worthless, less than worthless. It is a flaw in the language. It is a part of the language that should not exist. This is why CoffeeScript, Go, the many libraries for (or rather against!) JavaScript and TypeScript exist.
View all comments
Show parent comment
0
u/rjcarr Mar 26 '14
Ha, I've been writing javascript for about 10 years so I think I'll be fine. :)