Skip to content

Comment on What the fuck javascript

You are viewing one comment and its replies. View all comments · View the comment above

Comments

  • NaN is a error and it’s your responsibility to handle it gracefully. No need to halt the entire program when you fuck up some maths.

    20
    • NaN is a error

      Error.isError(NaN)
      // False
      
      8
      • @lime@feddit.nu· · edited

        nan is a ieee754-defined error. what javascript calls errors these days (it tends to change a lot) has little to nothing to do with that. it’s on every developer to familiarise themself with ieee754, it’s one of the most important documents in the profession.

        while nan is an invalid floating-point number, it is a valid value for a float-typed field. making it into an error is like adding a bit labelled “crash” to every number in your program.

        18
      • Collapsed, score -15 is below -5. 1 reply hidden.

Sign in to comment. Sign in