QuizNot attempted
super() in constructors
1–4 to choose, Enter to submit
Show answer & explanation
Correct answer:
- ReferenceError: the instance does not exist until the parent constructor creates it
- In a derived class the parent constructor allocates the object, so until
super()returnsthisis uninitialized and touching it throws ReferenceError. - Not 'an empty object': there is no object yet.
- Not 'calls super() for you': only an omitted constructor gets an implicit
super(...args). - Not 'TypeError only in strict mode': class bodies are always strict, and the error is a ReferenceError.