Of inherited objects - JavaScript Tutorial

Object-oriented programming is a very important aspect is that of inherited objects. Object A Object B through inheritance, you can directly have all the properties and methods of the object B. This is useful for reuse of code.

Most object-oriented programming language, is through inheritance "class" (class) to achieve the object. Traditionally, the JavaScript language is not inherited by the class, but "prototype object" (prototype) implementation, JavaScript This chapter describes the prototype chain of succession through.

ES6 introduction of grammar class, not in this tutorial class-based inheritance, see section "ES6 standard entry," a book.

 

Role of the prototype object, is the definition of the properties and methods of all instances of the shared objects. This is the reason it is called the prototype object, and the object instance can be viewed as child objects derived from the prototype object.

Guess you like

Origin www.cnblogs.com/songsongblue/p/11225055.html