Home > Web Front-end > JS Tutorial > How to use NaN attribute

How to use NaN attribute

不言
Release: 2019-01-31 15:08:20
Original
3651 people have browsed it

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.

How to use NaN attribute

Basic syntax of NaN attribute

Number.NaN
Copy after login

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>
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template