Javascript learning 3 -- javascript object-oriented (I)

Source: Internet
Author: User
The same is true for objects in JS. everythingisobject is the basis of everything. An object is a collection of variables and functions. Objects are generally derived from classes, and Classes define the owner of objects... syntaxHighlighter. all (); the objects in JS are also the same in JS. everything is object, which is the basis of everything. An object is a collection of variables and functions. Objects are generally derived from classes, and Classes define the attributes and methods of objects. If all your scripts are interactive operations between objects, you can say that this script is an object-oriented script. JavaScript is a prototype-based object-oriented language. It does not have the concept of classes. Everything derives from a copy of an existing object. Objects in JS are divided into two types: 1. Function objects. For example, the alert () Function can use parameters to change the functions of such objects, such as alert ('kfkf'); 2. Object objects, such objects cannot be called as Function objects and have fixed functions. Javascript inheritance in JS is prototype-based object-oriented, which leads to the inability to extend the underlying class structure of another class from one class. Inheritance in JS is implemented by simply copying methods from an object prototype to another object prototype. Let's take a look at the following example: [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.