Solution Review: "super" Keyword
Explore the use of the super keyword in JavaScript object-oriented programming. Understand why calling super in child class constructors is necessary to properly initialize this. This lesson reviews common errors and fixes through practical code examples and explanations for junior to mid-level interview preparation.
We'll cover the following...
We'll cover the following...
For the code above, you had to answer the following question:
Explanation #
Let’s incorporate each option in our code and see if it’s correct.
Option A: name and sex should be passed as parameters to Human().
Let’s do that and see the result.
The error is still there, so this is not the issue. This makes sense since we are setting definite values for name and sex, so we ...