The context of “this” in Javascript

Understanding the different contexts of this in Javascript is an important step towards truly understanding the language. In addition to its importance, it’s also something that has been written about to death.

If you’re using Javascript, and don’t fully understand how the this keyword in javascript works, here are some great articles that will give you the understanding you need.

this Resources

A brief overview of different “this” scenarios, from a good general Javascript overview called “Javascript Garden”

A longer, but still higher level overview

Another long-form explanation, with some additional technical detail

And a step by step, in-depth article

Checking your understanding

If you think you understand this, make sure you understand why each of the following work the way they do. If the examples make sense, you probably have a pretty decent understanding! If after those articles you still don’t fully understand, leave a comment or contact me for more explanation.