Sure you've seen and heard of the ES6 class
keyword. You might of also used the extends
keyword before in order to subclass your class
as well. However, do you actually understand what is happening behind the scenes? Could you de-sugar these keywords into basic programming functions? In this lesson we work with two classes that use the extends
keyword and recreate them with functions and built in methods. We also talk about some of the differences between a function
and a class
.
"two layers deep in our proto chain is the global Object.prototype object, even though we connect the two functions up here with the setPrototypeOf."
As you said, we might be surprised by this :) why is this happening ?
This is just the spec of the new
keyword against functions. Classes have additional logic built in that tells the new
keyword functionality to continue through the chain to connect it all... but functions simply do not.
Thanks ! Very high quality course by the way, congrats :)