JavaScript prototype (i)

Source: Internet
Author: User
Tags object object

Reference: http://2660311.blog.51cto.com/2650311/1358226/

1) Type, native Type, object type (types, primitive types, objects types)

Unlike when we were learning Java, we were told that Java was the language of full OOP: class is an abstraction of a class of objects with common characteristics, object is a specific implementation under a class, the object class is the top-level parent of all classes, and the knowledge of Java begins with classes and objects. JavaScript is not, it is the type of the Number,string, Boolean, object, Function,array, etc. that are encountered in various languages.

These types are divided into two main categories in JS: Primitive Type and object type, primitive types include: number,string, bool, null, undefined; the remaining non-native type objects are object types, including: object, array, function, etc. The object here specifically refers to objects with attributes (attribute), and the code examples in Firebug are as follows:

1 //1) Primitive Types2Logtypeof1);// Number3Logtypeof"");//string4Logtypeof false);//Boolean5Logtypeofundefined);//undefined6Logtypeof NULL);//object NULL is a special column, which belongs to the native type;7LogNULL instanceofObject);//false8 //2) object types.9Logtypeof NewObject);//ObjectTenLogtypeof NewFunction);//function OneLogtypeof NewArray);//Object A                                                                                                                                                                                                                                                                                                                                                             -Log (Opts.call (NewObject));//[Object Object] -Log (Opts.call (NewFunction));//[Object Function] theLog (Opts.call (NewArray));//[Object Array]

It is meaningless to judge what a value is, and it is often necessary to determine what type of native or object it is: Judging the native type, you can use the TypeOf keyword, and you can use the ToString () method to determine the object type. Don't understand

JavaScript prototype (i)

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.