Javascript Nan attributes

Source: Internet
Author: User
ArticleDirectory
  • Syntax
  • Description
Definition and usage

The Nan attribute is used to reference special non-numeric values.

Syntax
Nan
Description

You cannot use the for/in loop to enumerate the Nan attribute, or use the delete operator to delete it.

Nan is not a constant. You can set it to another value.

Tips and comments

Tip:Use isnan () to determine whether a value is a number. The reason is that Nan is not equal to all values, including itself.

Instance

In this example, we will show when a number exceeds the Infinity limit:

<SCRIPT type = "text/JavaScript"> var test1 = "300" Var Test2 = "Hello world! "Document. write (number (test1) + "<br/>") document. write (number (Test2) + "<br/>") document. write (isnan (test1) + "<br/>") document. write (isnan (Test2) </SCRIPT>

Output:

300
Nan
False
True
Tiy
Nan
How to Use Nan to determine a value

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.