That’s it. That’s the meme.

  • Semperverus@lemmy.world
    link
    fedilink
    English
    arrow-up
    0
    ·
    27 days ago

    This makes it make so much more sense…

    Its not really insanity, just a lot of hidden function calls

  • tetris11@lemmy.ml
    link
    fedilink
    arrow-up
    0
    ·
    26 days ago

    Yes, we should all use rigid types. Name me one language you actually like writing quickly with that has types?

    Pyth-oh. Bash-oh. Lisp-oh. Perl-oh. Oh yeah… typed languages suck because of all the boiler

  • jedibob5@lemmy.world
    link
    fedilink
    English
    arrow-up
    0
    ·
    26 days ago

    Javascript’s type coercion is rather insane, yes, but there is an actual, practical reason it’s done. JS, having been designed to be run in web browsers, wants to avoid blowing up and crashing at all costs. If it gets an unusual type comparison, usually the result of a bug, it tries to return something, such that the script can continue running if at all possible. In JS’ mentality, keeping a page running, even if it might not completely function properly, is preferable to throwing an unhandled exception and completely crashing it.

    Whether or not that is the right approach is debatable, but there is at least some logic to it. Personally, I think that the proliferation of Node letting JS run outside of browsers exacerbates a lot of JS’ issues, but TypeScript does a lot to make it look like a more sensible language.

  • yetAnotherUser@lemmy.ca
    link
    fedilink
    arrow-up
    0
    ·
    26 days ago

    Hey OP, do you mind checking if your book explains the type coercions that are used with the + operator? I remember it also being mind-boggling, so I was hoping you book could demystify it too.

    • Sleepless One@lemmy.mlOP
      link
      fedilink
      English
      arrow-up
      0
      ·
      26 days ago

      I don’t recall if it covers that sadly. I read it months ago and this part stood out to me.

  • kureta@lemmy.ml
    link
    fedilink
    arrow-up
    0
    ·
    25 days ago

    why convert boolean to integer instead of converting the other operand to boolean? it doesn’t make sense.