For the first around 5 years of my developer life, I never touched JS. I first learned Java and wanted to distance myself from it as far as possible as I assumed they were similar.
Well, they are. They’re both f*king stupid. In the same ways, no, but still stupid. In C#, if I wanted to check if something was a valid number, I’d simply use
myvar as int and check for null. If I compare that variable to another, it’ll do a type check. But instead, in JS, I have to do hacky BS like
if (!(myvar <= 0)) to check if something is not only greater than 0, but also not undefined and of the same type. Why can’t I just do
new Error("Cannot implicitly convert string to number").
Really. I get how useful
undefined returning falsey is. I’m guilty of it, even though I should be doing explicit checks of
var == undefined. But maybe we should only have that. We shouldn’t be worried about if the variable we’re checking is
reference undefined or
value undefined, or I’m gonna pull my hair out some more.