Get to know MDN better
The JavaScript exception "super() is only valid in derived class constructors" occurs when the super() call is used somewhere that's not the body of a constructor in a class with extends keyword.
The super() call is used to invoke the base constructor of a derived class, so the base class can initialize the this object. Using it anywhere else doesn't make sense.
super() can also be defined in an arrow function that's nested within the constructor. However, it cannot be defined in any other kind of function.
You cannot call super() if the class has no extends, because there's no base class to call:
You cannot call super() in a class method, even if that method is called from the constructor:
You cannot call super() in a function, even if the function is used as a constructor:
You can call super() before calling any other method in the constructor:
You can call super() in an arrow function that's nested within the constructor:
This page was last modified on Jul 8, 2025 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.