Skip to content

JavaScript Prototype

  • JavaScript

All object in JavaScript has a prototype property, the property is a simply reference to another object.

image

The modern browsers do provide a way to directly access the object’s prototype, but do not use it or set it, it will cause serious performance issue.

Object extend and reflection

Function constructor and “.prototype”

The prototype property on a function is NOT the prototype of the function, it’s the prototype of any objects that created via function constructors.

Using prototype chain to save more memory space

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *