• palordrolap
    link
    fedilink
    410 days ago

    Given it’s JavaScript, which was expressly designed to carry on regardless, I could see an argument for it returning NaN, (or silently doing what Perl does, like I mention in a different comment) but then there’d have to be an entirely different way of concatenating strings.

    • @[email protected]
      link
      fedilink
      English
      610 days ago

      expressly designed to carry on regardless

      I’m surprised they didn’t borrow On Error Resume Next from Visual Basic. Which was wrongly considered to be the worst thing in Visual Basic - when the real worst thing was On Error Resume. On Error Resume Next at least moved on to the next line of code when an error occurred; On Error Resume just executed the error-generating line again … and again … and again … and again …

    • @[email protected]
      link
      fedilink
      510 days ago

      Why would you need an entirely different way of concatenating strings? “11” + 1 -> exception. “11” + to_string(1) = “111”

      • palordrolap
        link
        fedilink
        210 days ago

        You’re right. I’ve got too much Perl on the brain and forgot my roots. There is a language that does what you’re talking about with the ‘+’ operator: BASIC

        Good luck getting the same thing retrofitted into JavaScript though. I can imagine a large number of websites would break or develop mysterious problems if this (mis)behaviour was fixed.

        • @[email protected]
          link
          fedilink
          110 days ago

          I don’t think there’s a way to retrofit JS - but php versions are deprecated all the time. Why not do the same with client-side script versions? :)