javascript: the good parts for humans (part 3)

8
JavaScript The good parts for humans (part 3) B Anjaneyulu Reddy Email: [email protected] Twitter: @_anji www.evibe.in

Upload: b-anjaneyulu-reddy

Post on 22-Jun-2015

143 views

Category:

Technology


0 download

DESCRIPTION

Javascript - this property, arguments property

TRANSCRIPT

Page 1: Javascript: The good parts for humans (part 3)

JavaScriptThe good parts for humans

(part 3)

B Anjaneyulu ReddyEmail: [email protected]

Twitter: @_anjiwww.evibe.in

Page 2: Javascript: The good parts for humans (part 3)

Agenda

Day 2 revisit

this property

arguments property

Page 3: Javascript: The good parts for humans (part 3)

Method invocation pattern

method: function stored as a property

this - object containing method

late binding

Sample 1

Page 4: Javascript: The good parts for humans (part 3)

Function invocation pattern

this - global object [design mistake]

inner functions this: refers to global object

var that = this

Sample 2

Page 5: Javascript: The good parts for humans (part 3)

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

Page 6: Javascript: The good parts for humans (part 3)

Apply invocation pattern

apply method• two parameters

o value for thiso array of parameters

this - first parameter of apply

Sample 4

Page 7: Javascript: The good parts for humans (part 3)

Questions?

Page 8: Javascript: The good parts for humans (part 3)

Thank You