Summary from The Principles of Object-Oriented Javascript BY Nicholas C. Zakas
I. Constructor & Prototypes
Generic objects (created via and object literal or the Object constructor): constructor -> Object.
Objects created with a custom constructor: constructor -> points back to constructor function.
With constructor, 200 instances have 100 copies of a function.
II. Module Pattern
Module Pattern: an object-creation pattern, creates singleton objects with private data
IIFE (immediately invoked function expression): a function expression that is defined and then called immediately to produce a result.
Revealing Module Pattern:
Pseudoclassical inheritance: minxin -- copies properties from one object to another so that the receiving object gains functionality without inheriting from the supplying object.
Prototypal inheritance:
Scope-safe constructor
No comments:
Post a Comment