F**king JavaScript Types
This post is more of a rant on JavaScript than anything.
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 myvar >= 0
? Why can’t it just assume the type from the comparison? Why can’t JavaScript just have f**king types? “Then it’s not a scripting language!” or “everything is an object!”. No. This isn’t Ruby. Types were introduced...