• @jjjalljs@ttrpg.network
    link
    fedilink
    3523 hours ago

    Javascript could throw an error to alert you that the input is supposed to be a string, like most languages would do.

    • Victor
      link
      fedilink
      -3
      edit-2
      20 hours ago

      But you’re calling a function specifically made for passing a string to an int… 😆 There’s gotta be some common sense somewhere here, guys.

      Still, it’s a very good point. JS should do this.

      I would suspect one reason it doesn’t do this is to be backwards compatible.

      • @listless
        link
        212 hours ago

        And god fucking forbid that common sense be in the language. Who the fuck needs a language with common sense, amirite?

    • @heavy@sh.itjust.works
      link
      fedilink
      English
      -322 hours ago

      Theoretically, Javascript is an untyped language, so there aren’t supposed to really be static types. Giving type errors in this situation would be against design.