Home >Web Front-end >JS Tutorial >How to use NaN attribute
The NaN attribute represents a "non-numeric" value. This attribute indicates that the value is not a legal number. The NaN attribute is the same as the Number.Nan attribute. In this article, we will introduce the basic usage of the NaN attribute.
Basic syntax of NaN attribute
Number.NaN
Now that we know the basic syntax of NaN attribute, let’s take a look at the usage of NaN attribute
Let’s look at a specific example
The code is as follows
<!DOCTYPE html> <html> <head> <title></title> </head> <body> <script type="text/javascript"> var Month=30; if (Month < 1 || Month > 12) { Month = Number.NaN; } document.write(Month); </script> </body> </html>
The result displayed on the browser is: NaN
This article It’s all over here. For more exciting content, you can pay attention to other related column tutorials on the PHP Chinese website! ! !
The above is the detailed content of How to use NaN attribute. For more information, please follow other related articles on the PHP Chinese website!