I think javascript is a great language, but it has some really ugly parts.

For some reason, it really annoys me that JS developers are ok with things like

if (typeof something === "undefined")

I mean, comparing strings like that!

  • 0
    Ya, seems a little verbose, but how would you do it? In earlier versions of JavaScript, the undefined keyboard actually represented a variable that was mutable, so checking the value of typeof was a reliable way to see if a value was undefined. You could also do

    if (value === void 0)

    But the. You'll rely on people knowing what void 0 returns.
  • 1
    @tytho yes, I understand the situation (and I didn't know about void 0, thanks).

    my rant is about the fact that js devs are ok with what appears to be a hack.
  • 0
    @noamtm agreed, there are definitely some ugly parts of js, and a majority of the ugliness comes from type checking
Your Job Suck?
Get a Better Job
Add Comment