How to use isNaN and its introduction

Source: Internet
Author: User

Nan is not a number

The IsNaN () function attempts to convert the value to a numeric value after it has been received.

1 alert (IsNaN (NaN));   // true 2 alert (IsNaN);     // false, 25 is a numeric value 3 alert (IsNaN ('))    //false, ' 25 ' can be converted to a value of 4 alert (IsNaN (' Lee '))    //true, ' Lee ' cannot convert to value 5 alert (IsNaN (true))    // false, true can be converted to 1

The IsNaN () function can also be applied to an object. During the call to the IsNaN () function, the valueof () method is called first, and then the return value is determined to be converted to a number. If not, then test the return value based on this return value in the call to the ToString () method.

var box={    toString:function() {       return ' 123 ';  // can be changed to return ' Lee ' to see the effect;    }};alert (IsNaN (box));   // false

How to use isNaN and its introduction

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.