This article mainly introduces the use of Nan value in JavaScript, is the basic knowledge of JS introductory learning, the need for friends can refer to the
literal constant without quotes Nan is a special value that represents not a non-numeric number. Because Nan is always in a relatively unequal situation, in any number, including Nan, it is usually an error condition for a function that indicates that a valid number should be returned.
Note: Use the isNaN () global function to see if the value is a Nan value.
Grammar
You can access properties using the following syntax:
?
Example:
Here, DayOfMonth assigns Nan, if it is greater than 31, and displays a message indicating the valid range:
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24-25 |
|
This will produce the following results:
?
1 |
Day of Month must is between 1 and 31. Value of Dayofmonth:nan |