Object-Oriented Programming

Source: Internet
Author: User

1. JS oriented (based on) object programming- class (Prototype object) and object (Instance object)

2. JS oriented (based on) object programming- construction method and this

1.1 Preliminary Master JS class (Prototype object) and object
1.2 What are member variables and member methods
1.3 Mastering the use of construction methods

JS is a pair-oriented dynamic scripting language, is a scripting language based on object and event-driven (EventDriven) and has security performance, he has various characteristics of object-oriented language, such as encapsulation (private, public two), Inheritance (Object impersonation method implementation), polymorphism , etc. for most people, JS as a functional language, only used as some simple front-end data input validation and implementation of some simple page effect, in many excellent Ajax framework, Eg:extjs, JQuery JS Object-oriented features are used extensively.

Case 1: Zhang Lao Tai has two cats small white, white, 3 years old, Floret, suit, 10 years old, enter the cat's name Output cat age suit, the wrong display does not have this cat.

1, the class is abstract, represents a class of things, such as people, animal objects seem specific

2, actual, representing a specific thing

3, the class is the template of the object instance, the object instance is an individual of the class

Special Note: JS in everything is the object

Custom Methods for classes

1. The constructor constructor creates the class before creating the object instance

Function class name/prototype () {}

var object name =new class

Object-Oriented Programming

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.