Skip to content

reflection

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