4 ms·
random thought: To see if something equals NaN,can't you just check for the stringified form of the number equaling "NaN"? after all, the usual WTF lists for J
by torben-friis 1y ago
random thought: To see if something equals NaN,can't you just check for the stringified form of the number equaling "NaN"?
after all, the usual WTF lists for JS usually have a stringified NaN somewhere as part of the fun.
- spand 1y agoIt can usually be implemented like this. No need for strings. fun isNan(n) = n != n
- torben-friis 1y agoAh, clever!
- chuckadams 1y agoAlso no need to define that in JS, because Number.isNaN() has been around forever (note the case). The global isNaN() has been there from the very beginning, but use Number.isNaN() because it doesn't coerce the param to a number.