Several necessary reserve (b) (... to be done) before learning Vue source

7 important reserve

  1. Flow basic grammar
  2. Publish / subscribe model
  3. ES6 + syntax
  4. Prototype chain, closure
  5. Function currying
  6. event loop

Then speaking

Talk to several important grammar for ES6, plus down to fourth spot resumes.

 

4. prototype chain, closure

Prototype chain

We inherited from the front is definitely a very familiar must also be familiar with a high-frequency will understand knowledge. Familiar to interview as long as there will be questions about succession; and source code using inheritance can be seen everywhere.

There are still a lot of front-end may not have a grasp of the whole inheritance of implementation and application. Chase The reason for no more than two:

  1. ECMAScript implementation methods inherited from other object-oriented class based implementation inheritance (Object Oriented) languages.
  2. Even work on how to implement inheritance little knowledge, a little also not delay the write logic code.

Because no matter which reason it is necessary to understand as soon as possible inheritance of implementation and application, otherwise it will shed no tears technology.

Speaking before the ECMAScript concept of inheritance, let me say at the concept and prototypes class.

class

Speaking before the ECMAScript concept of inheritance, let me say that under the concept of class. (If contact with Java or C ++, then we know inherit Java (C ++) are class-based inheritance)

Categories: base object is oriented (Object Oriented) language information package, called class type. Each class contains a set of data instructions and manipulate data or message transfer function. Examples of classes are called objects.
Class: organizational structure is described in the form of codes.

 

prototype

This JavaScript language has no concept of class, so JavaScript is not class-based inheritance, but the prototype-based inheritance. ( Mainly learn Self Prototype ( prototype) inheritance ).

Note: The concept of class ES6 the class keyword and OO languages ​​are different. ES6 inside the class-based inheritance is also a prototype implementation.
JavaScript abandoned in favor of using the prototype class as a basis for implementation inheritance, because inheritance is compared to the prototype-based inheritance based class is more simple in concept. 
First, we make it clear that the purpose of the existence of the class is to instantiate the object, and JavaScript can create objects directly through the object literal syntax is easy.
Each function has a prototype property. All through function new objects out of, this object has a __proto__ point to this function prototype . When a function you want to use an object (or an array): if the object itself has this function, then used directly; if the object does not have this feature, then go __proto__ find the.

Guess you like

Origin www.cnblogs.com/magicg/p/12617225.html