JavaScript native reference types
淡淡烟草味
淡淡烟草味 2017-06-12 09:30:53
0
3
929

Do the native reference types in JavsScript, such as the Object type, use the constructor pattern?

淡淡烟草味
淡淡烟草味

reply all(3)
女神的闺蜜爱上我

js is a language based on prototypal inheritance. At the beginning of the creation, I referred to Scheme, which uses functions as first-class citizens, the syntax of C language, and the prototypal inheritance of self language, so it is a combination of the advantages of the three; it was originally called LiveScript, but Java was very popular at the time, so the company changed its name. It's called JavaScript, but actually it has nothing to do with java.
The advantage of prototypal inheritance is that it allows multiple inheritance and can simulate classes, but class languages ​​can never simulate prototypes. This is the flexibility of JavaScript, which can be used for both functional programming and object-oriented programming.

给我你的怀抱

http://www.cnblogs.com/wangfu...

Ty80

Classes and objects in JavaScript are inherently controversial because they use prototypal inheritance, which is inheritance achieved by referencing methods on the prototype chain. The methods on the object you call will ultimately call the methods above Object.prototype. Even if these methods are not defined using new but are defined using object literals, they can still be called.
That is, if you modify the method on Object.prototype, then the method called by all objects will change. All constructors in JavaScript are actually faked using prototypal inheritance. Even the newly added class in ES6 is essentially implemented using prototypal inheritance. So we still need to have a deeper understanding of how prototypal inheritance is implemented.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template