In this document, we will cover the this
keyword, object prototypes, uses of .call()
and .apply()
, lexical this
, arrow functions, es6 classes, object behavior delegation, some class theory, and objects-linking-other-objects. Our motivation is to learn these concepts is that we must know the finer points of object creation, assignment of values, and behavior delegation in order to better understand Javascript.
The this
keyword is a special mechanism in Javascript - it allows us to implicitly pass reference values to other objects.
It is a source of frustration for many developer's, but it's not as complicated as they make it out to be. In this section, we'll cover the this
keyword, how it functions, why it's useful, and how it can help us write more expressive code.
this
has nothing to do with where a function is declared, but everything to do with how a function is called. When a function is invoked, an act