Embed presentation
Download to read offline



![Function invocation pattern
this - global object [design mistake]
inner functions this: refers to global object
var that = this
Sample 2](https://image.slidesharecdn.com/day3-140806225257-phpapp01/85/Javascript-The-good-parts-for-humans-part-3-4-320.jpg)





This document discusses different patterns for invoking functions and setting the value of 'this' in JavaScript. It covers: the method invocation pattern where 'this' refers to the object containing the method; the function invocation pattern where 'this' defaults to the global object; the constructor invocation pattern where 'this' refers to a new object created; and the apply invocation pattern where 'this' is explicitly set as the first parameter of the apply method.



![Function invocation pattern
this - global object [design mistake]
inner functions this: refers to global object
var that = this
Sample 2](https://image.slidesharecdn.com/day3-140806225257-phpapp01/85/Javascript-The-good-parts-for-humans-part-3-4-320.jpg)



