• AbsolutelyNotCats@lemdro.id
    link
    fedilink
    English
    arrow-up
    37
    ·
    edit-2
    1 year ago

    Just a reminder that JavaScript was developed in 10 days, the same amount of time i spend fixing bugs when i just miss a “,”

    • Rikudou_Sage@lemmings.world
      link
      fedilink
      arrow-up
      0
      arrow-down
      1
      ·
      1 year ago

      Has anyone actually read through that? Reading the first few examples and it’s just not understanding how languages work half of the time:

      !!"false" == !!"true"; // -> true
      !!"false" === !!"true"; // -> true
      

      Wow, no shit, non-empty string coerces to true, who would’ve guessed! Did you know that !!"bullshit" === !!"true" as well? Mind=blown.

      NaN === NaN; // -> false
      

      Again, no shit, that’s in the NaN specification and the page even mentions it, so why even include it?

      • noli@programming.dev
        link
        fedilink
        arrow-up
        2
        ·
        1 year ago

        Which is why I’m of the opinion that dynamically typed languages are evil. !!“false” should either be caught at compile time or raise an exception.

        I’m thoroughly convinced that the only use of dynamically typed languages is to introduce bugs

        • Rikudou_Sage@lemmings.world
          link
          fedilink
          English
          arrow-up
          0
          arrow-down
          1
          ·
          1 year ago

          Why? IMO that’s perfectly valid. The various type coercions are sometimes crazy, but IMO the rule that non-empty string is coerced to true and empty string to false is very simple to follow. The snippet is not even a gotcha, I don’t see anything worth failing over. Putting “true” or “false” in a string doesn’t change that.