JavaScript
The good parts for humans
(part 3)
B Anjaneyulu Reddy
Email: anji.t6@gmail.com
Twitter: @_anji
www.evibe.in
Agenda
Day 2 revisit
this property
arguments property
Method invocation pattern
method: function stored as a property
this - object containing method
late binding
Sample 1
Function invocation pattern
this - global object [design mistake]
inner functions this: refers to global object
var that = this
Sample 2
Constructor invocation pattern
functions invoked with new prefix
this - new object created
no explicit return value - this is returned
hidden link to function's prototype
Sample 3
Apply invocation pattern
apply method
• two parameters
o value for this
o array of parameters
this - first parameter of apply
Sample 4
Questions?
Thank You

Javascript: The good parts for humans (part 3)