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.
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.
0
u/[deleted] Mar 26 '14
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.