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”
There are different kinds of non-number “values” for numeric variables. Is this
∞,Overflow,NaNorN/A?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”🎵 I’m a Java girl in a Java world…
Sadly, JavaScript breaks the cadence :(
Whaaat Javascript is famously known for being extremely weird with NaN values lol
Yeah but we almost never use them intentionally. In almost any project, NaN only happens if there’s a bug. The others are regularly on purpose.
People use NaN on purpose? 😨😨😨
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,
undefinedseems to mean the value has not yet been evaluated. Maybenullis really the best.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.I mean,
NaNimplies there exists some value, it’s just not a numerical one.nullsays there is none at all.