JavaScript
The good parts for humans
(part 6)
B Anjaneyulu Reddy
Email: anji.t6@gmail.com
Twitter: @_anji
www.evibe.in
Agenda
Day 5 revisit
Inheritance
Inheritance
Patterns
Pseudoclassical
Prototypal
Functional
Constructor functions
Sample 1
Pseudoclassical
Prototypal
Objects inherits from objects
Differential inheritance
Sample 2
Functional (1 of 2)
Create a function which has 4 steps
o It creates new object
- Object literal
- Constructor function with new keyword
- Object.create()
- call a function which returns an object
o It has private (local) instance variables and methods
o It augments that new object
o return that new object
Functional (2 of 2)
// pseudocode
var constructor = function(spec) {
var that,
other private instance variables;
that = a new object
Add privileged methods to that
return that;
}
Sample 3
Questions?
Thank You

Javascript: The good parts for humans (part 6)