Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
spand
· 1y ago · 0 comments
It can usually be implemented like this. No need for strings.
fun isNan(n) = n != n
Comments
[–]
chuckadams
1y ago
Also 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.
[–]
torben-friis
1y ago
Ah, clever!