I’ve got to write to a db table (using Zinc) and the field requires a data type of Number. In my application, the user enters a string, which could be letters in which case I’ll throw an error.
So far, im using Number(a) to convert to a number, but if the string wasn’t a number, I of coarse get “NaN”.
But how do i do a conditional that checks for NaN?
b = Number(a)
if(b == NaN) …this doesn’t work
if(b == “NaN”) also doesn’t work nor does
if(b == Number.NaN)
Maybe theres a better way to check for a number, if so, please let me know
Thanks!