Get to know MDN better
The JavaScript exception "class constructors must be invoked with 'new'" occurs when a class constructor is called without the new keyword. All class constructors must be called with new.
In JavaScript, calling a function without new and constructing a function with new are two distinct operations, and functions can behave differently depending on how they are called.
Traditionally, JavaScript functions have been used as both constructors and normal functions, and can detect how they were called using new.target. However, class constructors are always constructors and cannot be called as normal functions.
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.