• Victor@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    10 months ago

    Classic people who don’t know how to code wat. Passing a number in place of a string argument because they don’t know what they’re doing.

    • jjjalljs@ttrpg.network
      link
      fedilink
      arrow-up
      0
      ·
      10 months ago

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

      • heavy@sh.itjust.works
        link
        fedilink
        English
        arrow-up
        0
        ·
        10 months 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.

        • bleistift2@sopuli.xyz
          link
          fedilink
          English
          arrow-up
          0
          ·
          10 months ago

          JavaScript has types and it does have type errors, for instance

          > null.foo
          Uncaught TypeError: null has no properties
          

          Please stop spouting nonsense on issues you know nothing about.

          • heavy@sh.itjust.works
            link
            fedilink
            English
            arrow-up
            0
            arrow-down
            1
            ·
            10 months ago

            Dynamic types aren’t static types my man. I think you got some learning to do.

      • Victor@lemmy.world
        link
        fedilink
        arrow-up
        0
        ·
        edit-2
        10 months 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.