WHAT’S IN THIS CHAPTER?
- Understanding how a function’s call-site determines the value
thiswill have within the function
applyto explicitly specify the value this will have within a function
- Using polyfills to implement language features that aren’t natively supported by a browser
bindto permanently set the value of this in a function, regardless of its call-site details
WROX.COM CODE DOWNLOADS FOR THIS CHAPTER
You can find the wrox.com code downloads for this chapter at
Unlike classical languages such as C# and Java in which
this always references the object that “contains” the function that’s executing, the value of
this should be bound to. We’ll review those rules in the next section to set the stage for the primary topic of this chapter:
Function.prototype, which allow programmers to explicitly control the value to which
this is bound.
EXPLORING HOW THIS IS BOUND
In this section, we describe the four types of ...