A TypeError is thrown when a value is a different type than what was expected.
Browser/User Agent Support
| IE | Mozilla | Netscape | Opera | Safari | 5.0+ | 1.0+ | 6.0+ | no | no |
|---|
Constructors
| Constructor | IE | Mozilla | Netscape | Opera | Safari |
|---|---|---|---|---|---|
Creates a new instance of TypeError. | 5.0+ | 1.0+ | 6.0+ | no | no |
Properties
| Property | IE | Mozilla | Netscape | Opera | Safari |
|---|---|---|---|---|---|
An error message associated with the TypeError. | 5.0+ | 1.0+ | 6.0+ | no | no |
Specifies the type of exception. | 5.0+ | 1.0+ | 6.0+ | no | no |
Remarks
A TypeError is most commonly thrown when you try to access a value that is unexpectedly null or undefined. A TypeError can also be thrown if you use the
References
Error | Error.message | Error.name
Availability
JavaScript 1.5 | JScript 5.5 | ECMAScript v3
Constructor Detail
TypeError TypeError([String message])
Creates a new instance of TypeError.
| String | message | Error message that provides information about the exception. (optional) |