I’ve only been trying it in Firefox’s JavaScript console, but neither of the following statements return true:
parseFloat('geoff') == NaN; parseFloat('geoff') == Number.NaN;
Try this code:
isNaN(parseFloat("geoff"))
For checking whether any value is NaN, instead of just numbers, see here: How do you test for NaN in Javascript?
2.1m questions
2.1m answers
60 comments
57.0k users