• getFrog@piefed.social
      link
      fedilink
      English
      arrow-up
      7
      ·
      12 hours ago

      I’m a JavaScript girl, I only know about null and undefined. But my guess would be N/A, just by method of elimination?

      : They said the N-word, but if we ask “did they say the N-word yesterday?” and go back a day if the answer is no, we will be iterating forever.
      Overflow: They said the N-word sometime before Jan 1st 1970.
      NaN: Days since the last time they said the N-word: “yes”

      • ChaoticNeutralCzech@feddit.org
        link
        fedilink
        English
        arrow-up
        2
        ·
        12 hours ago

        There are actually two interpretations of N/A:

        • N/A (not available): There is lost media so it can’t be evaluated.
        • N/A (not applicable): The show is in sign language so evaluating that is outside the scope of this string-matching program.

        Meanwhile, undefined seems to mean the value has not yet been evaluated. Maybe null is really the best.

      • BlackRoseAmongThorns@slrpnk.net
        link
        fedilink
        arrow-up
        1
        ·
        10 hours ago

        All these special values are from the spec for floating point numbers, integers don’t have them, in JS specifically all numbers are floats.

        An Option<int> does a good of showing intent.