Standard built-ins

TypeError()

Try the free JavaScript compiler

Indicates an inappropriate type or operation, such as calling a noncallable value. Creating it does not throw automatically.

Formal Syntax & Structure

javascript syntaxjavascript
new TypeError([message], [options])

Parameters & Attributes

NameTypeDescription
messageStringDiagnostic text.
optionsObjectOptional cause property.

Return Value

TypeError

Error subtype instance.

Working Example

Example Snippetjavascript
console.log(new TypeError("example").name);
JavaScript Reference