Thursday, September 4, 2025
HomeLanguagesJavascriptJavaScript TypeError – “X” is not a constructor

JavaScript TypeError – “X” is not a constructor

This JavaScript exception is not a constructor that occurs if the code tries to use an object or a variable as a constructor, which is not a constructor.

Message:

TypeError: Object doesn't support this action (Edge)
TypeError: "x" is not a constructor

TypeError: Math is not a constructor
TypeError: JSON is not a constructor
TypeError: Symbol is not a constructor
TypeError: Reflect is not a constructor
TypeError: Intl is not a constructor
TypeError: Atomics is not a constructor

Error Type:

TypeError

Cause of Error: Somewhere the code is trying to use an object or a variable as a constructor, which is not a constructor.

Example 1: In this example, the variable(‘var2’) which is a string, is used as a constructor, So the error has occurred.

Javascript




let var2 = "This is string";
console.log(new var2());


Output(In Edge console):

TypeError: Object doesn't support this action

Example 2: In this example, Math is used as a constructor, So the error has occurred.

Javascript




console.log(new Math());


Output(In Edge console):

TypeError: Object doesn't support this action
Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
RELATED ARTICLES

Most Popular

Dominic
32263 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6627 POSTS0 COMMENTS
Nicole Veronica
11799 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11858 POSTS0 COMMENTS
Shaida Kate Naidoo
6749 POSTS0 COMMENTS
Ted Musemwa
7025 POSTS0 COMMENTS
Thapelo Manthata
6696 POSTS0 COMMENTS
Umr Jansen
6716 POSTS0 COMMENTS