TypeError : Error

A TypeError is thrown when a value is a different type than what was expected.

Browser/User Agent Support

IEMozillaNetscapeOperaSafari
5.0+1.0+6.0+nono

Constructors

ConstructorIEMozillaNetscapeOperaSafari
Creates a new instance of TypeError.
5.0+1.0+6.0+nono
 

Properties

PropertyIEMozillaNetscapeOperaSafari
An error message associated with the TypeError.
5.0+1.0+6.0+nono
 
Specifies the type of exception.
5.0+1.0+6.0+nono
 

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 operator on a value that is not a constructor or if you pass too many arguments to a built-in function.

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.

StringmessageError message that provides information about the exception. (optional)

Property Detail

String message

An error message associated with the TypeError.

See Also

Error.message

Availability

JavaScript 1.5 | JScript 5.5 | ECMAScript v3

String name

Specifies the type of exception.

Availability

JavaScript 1.5 | JScript 5.5 | ECMAScript v3