If some of the functions in lesson 6 were new to you, we hope the resource links will help.
- 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 functions surrounding context. In other words, the value of.this
inside an arrow function is the same as the value of.this
outside the function.
Classes in ES6 are just a mirage and hide the prototype inheritance 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.