NaN

Nan stands for "Not a Number". It's what is displayed when the answer isn't numeric. JavaScript has to have some way of telling you that it can't extract a numeric value from the string you've given. It can't return a number - zero for example - because that might have been the valid result of a conversion. Instead it returns the special value NaN.

Note that this isn't the three-letter string "NaN". It's a special value in JavaScript called NaN.

Testing for NaN

Because NaN has no value it can cause some problems when you're testing the value of a variable. JavaScript can't compare NaN with anything else because NaN doesn't have a value. All we can say is that it's "Not a Number". Whatever comparison you try you will get false as the answer.

The solution is to use the isNaN() function. This will return true if it's give the value NaN as a parameter.

Related Items

FoxPro numeric functions

FoxPro numeric commands and functions.

Read More

Numeric Functions in Access VBA

Access VBA functions which work with numeric values.

Read More