Important features of JavaScript

Source: Internet
Author: User

Javascript is a prototype-based language ), c ++, Object Pascal, C #, and Java are class-based languages. Another important feature is that JavaScript is a dynamic language, c ++ is a static language (C # also introduces some dynamic features in version 4.0 ).

Class-based language (Java) Prototype-based language (JavaScript)
Classes and instances are independent entity concepts. All objects are instances.
Define a class using the Definition Statement of the class. Use the constructor to instantiate a class. Use constructors to define and create a series of objects
Use the new operator to create an object Same
Use the Definition Statement of the class to define a subclass of an existing class, and then create the hierarchical relationship of the object. Create an object using the constructor class, assign a prototype object and associate it with an existing construct an object hierarchy by assigning an object as the prototype associated with a constructor function.
Inherit properties by following the class chain.
Inherit attributes through classes
Inherit properties by following the prototype chain.
Inherit attributes through prototype
Class Definition specifies all properties of all instances of a class. Cannot add properties dynamically at run time.
Class defines all attributes of the instance and cannot be dynamically added at runtime.
Constructor function or prototype specifies an initial set of properties. Can add or remove properties dynamically to individual objects or to the entire set of objects.
The constructor or prototype defines the original set of attributes. You can dynamically add or delete attributes at runtime.

 

Refer: 

Http://en.wikipedia.org/wiki/Prototype_pattern

Http://en.wikipedia.org/wiki/Prototype-based

Http://en.wikipedia.org/wiki/JavaScript

Class-based vs. Prototype-based ages

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.