If some of the functions in lesson 6 were new to you, we hope the resource links here will help you:
- Arrow Functions: () => {}
- Link 1: '.this' keyword changes with Arrow Functions
- Link 2: '.this' keyword changes with Arrow Functions
- Default Function Parameters
- Destructuring: Arrays & Objects
- Classes: read more below
- Super: keyword
- Extends: keyword
With regular functions, the value of '.this' is set based on how the function is called. With arrow functions, the value of '.this' is based on the function's surrounding context. In other words, the value of '.this' inside an arrow function is the same as the value of '.this' outside the function.
In ES6 classes are just a mirage and hide the fact that prototypal inheritance is actually going on under the hood, let's quickly look at how to create a "class" with ES5 code:
super must be called before '.this' In a subclass constructor function, before '.this' can be used, a call to the super class must be made.