Special comparisons such as Undefined,nan in JavaScript

Source: Internet
Author: User
The following is transferred from: http://blog.csdn.net/hongweigg/article/details/38090093

1. Question: In JavaScript, typeof (undefined) = = undefined established?

Answer: Not true, the global function typeof () returns a value type of string type , six possible values: "Number", "string", "Boolean", "Object", "function", and "undefined".

Only typeof (undefined) = = "undefined";

is set up.

2, typeof (null) = = ' undefined ' established?

Answer: Not valid, NULL is the object type of data, so typeof (null) = = ' object ' is established.

3, typeof ([up]) = = ' array ' Set up?

Answer: No, the typeof () return value does not have an "array" type, nor is there a "date" type.

4, undefined = = undefined set up?

Answer: Set up.

5, NULL = = NULL set up?

Answer: Set up.

6, Nan = = Nan set up?

Answer: not set up. NaN is not equal to any value, including itself. To detect if a value is NaN, use the isNaN function.

7, typeof (NaN) = = ' number ' Set up?

Answer: Set up. Nan is the data that belongs to number type.

Finally, NULL is the data of type Object, Nan is the data of type number, undefined is the data of type undefined, that is, there is no definition, the properties and methods of the object or object cannot be found.

Special comparisons such as Undefined,nan in JavaScript

Related Article

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.