Standard built-ins
TypeError()
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
| Name | Type | Description |
|---|---|---|
| message | String | Diagnostic text. |
| options | Object | Optional cause property. |
Return Value
TypeError
Error subtype instance.
Working Example
Example Snippetjavascript
console.log(new TypeError("example").name);