JavaScript · Middle · Question 9 of 75
Why must a subclass constructor call super() before accessing this?
- ✓Correct answer: The parent constructor creates the object; before
super(),thisdoesn't exist yet - 2Without
super(), the parent's methods won't be copied to the child class - 3It's a linter convention; the language itself doesn't require this order
Explanation
In a derived class, the instance is created by the parent constructor, so accessing this before super() throws a ReferenceError. The parent's methods aren't copied - they're available through the prototype.