- Published on:
- February 18, 2012
- Objects are basically hashmaps
- Calling ‘new'
- Functions are sort of like classes
- ES5 (strict mode)
- Old SproutCore used arguments.callee to implement super
- The new object inherits the function's prototype
- Prototypes are referenced, not copied
- Don't monkey with Object.prototype
- Should you override native prototypes?
- Object.keys vs for x in y
- Premature optimization
- Property iteration
- 3 paradigms
- function newX()
- Object.create(prototype) (contributed by Yehuda in the backchannel)
- Data privacy
- jQuery uses the prototype system
- Don't be over obsessed with privacy
- Functions create closures
- Closures carry the context they were created in
- Scoped variables in closures are also referenced, not copied. So, changes to those variables are reflected to everything else in that scope.
- Closures can make memory management and scoping problems worse, but are generally a good thing
- Waterfall pattern: keep functions in the same scope/indentation level and call the next when one finishes
- Array syntax creates an object that inherits a specific prototype
- Object keys can only be a string
- How to think about OO
- EMCAScript 5 Objects and Properties
- Closure in action
- More issues with closures
- Add behaviors to objects or static clases with ‘mix'
- Code example – Prototypeal Inheritance