Home  >  Article  >  Web Front-end  >  How to use NaN attribute

How to use NaN attribute

不言
不言Original
2019-01-31 15:08:203561browse

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

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!

Statement:
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
Previous article:How to use test methodNext article:How to use test method