• shilangyu (lemmur)@lemmy.ml
    link
    fedilink
    arrow-up
    13
    ·
    edit-2
    3 years ago

    I’m so bored of people bringing up NaN !== NaN when talking about “javascript’s wonkiness”. This is defined by IEEE for the floating point standard and it appears any other language using IEEE 754 (which is the majority)

    • handvat@lemmy.ml
      link
      fedilink
      arrow-up
      5
      ·
      3 years ago

      You shouldn’t attempt comparing 2 floating point numbers with simply == (or === in JavaScript) in most cases and in most languages anyways.

    • spytfyre@lemmy.ml
      link
      fedilink
      arrow-up
      1
      ·
      3 years ago

      Totally agree. Moreover I can not think of a valid scenario where you would use such a comparison

  • blank_sl8@lemmy.ml
    link
    fedilink
    arrow-up
    10
    ·
    3 years ago

    Meh, not a great article. It gets off to a pretty poor start by stating that Typescript is “risky” because it has to interact with third-party APIs that are inevitably not written in Typescript. But really, it’s still a lot less risky compared to raw JS.

  • Mobocratic Egoist@lemmy.161.social
    link
    fedilink
    arrow-up
    8
    ·
    3 years ago

    I think most are fair points, except I disagree that static types are not helpful. Static typing is preferable over dynamic typing but is difficult to do well. PHP and Python have type annotations now, and I think it would be good if JS introduced them as well. That would be a better solution than TypeScript.

    • shilangyu (lemmur)@lemmy.ml
      link
      fedilink
      arrow-up
      6
      ·
      edit-2
      3 years ago

      It would seem to me that introducing typing to JS like in Python or PHP would just end being TypeScript, so why would it be a better solution? Do you mean it being a first class citizen in the JS world?

      • Mobocratic Egoist@lemmy.161.social
        link
        fedilink
        arrow-up
        4
        ·
        3 years ago

        Yes, I mean making it a first class citizen of standard JS. That would be a step towards all JS libraries coming with type annotations without having to convert everything to TypeScript.