this in JavaScript

All you ever need to know about this is that this is the current context.

Ryan Morr has a good explanation of the difference between scope and context.

Every function invocation has both a scope and a context associated with it. Fundamentally, scope is function-based while context is object-based. In other words, scope pertains to the variable access of a function when it is invoked and is unique to each invocation. Context is always the …

Read Article

Prototypal Inheritance in JavaScript

Every function has a prototype property that is an object originally set with at least two properties:

constructor: points back to the function itself __proto__: points to the prototype that the function’s prototype itself (an object) inherited from. (Object.prototype)

If that description of the __proto__ property doesn’t make much sense, I’m hoping it will by the end of this article.

Every object has a __proto__ property. When a new instance of an object is created, the __proto__ property points …

Read Article