# TypeError : Error
Return to: JavaScript Core index

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

## Platform Support

IE | Mozilla | Netscape | Opera | Safari
--- | --- | --- | --- | ---
5.0+ | 1.0+ | 6.0+ | no | no

## Constructors

Constructor | Action | IE | Mozilla | Netscape | Opera | Safari
--- | --- | --- | --- | --- | --- | ---
TypeError Constructor([String message]) : TypeError Creates a new instance of TypeError. | Show Details | 5.0+ | 1.0+ | 6.0+ | no | no

### TypeError([String message]) : TypeError

Creates a new instance of TypeError.

Parameters

String | message | (optional)Error message that provides information about the exception.

Returns

TypeError |

## Inherited Properties

Property | Action | IE | Mozilla | Netscape | Opera | Safari
--- | --- | --- | --- | --- | --- | ---
constructor : Object Specifies the function that creates the Error prototype. | Show Details | 5.0+ | 1.0+ | 6.0+ | 7.0+ | 1.0+

Availability

  JavaScript 1.5|JScript 5.0|ECMAScript v3

message : String Error message. | Show Details | 5.5+ | 1.0+ | 6.0+ | 7.0+ | 1.0+

Availability

  JavaScript 1.5|JScript 5.5|ECMAScript v3

name : String Error name. | Show Details | 5.5+ | 1.0+ | 6.0+ | 7.0+ | 1.0+

Availability

  JavaScript 1.5|JScript 5.5|ECMAScript v3

## Properties

Property | Action | IE | Mozilla | Netscape | Opera | Safari
--- | --- | --- | --- | --- | --- | ---
message : String An error message associated with the TypeError. | Show Details | 5.0+ | 1.0+ | 6.0+ | no | no

See Also

  Error.message

Availability

  JavaScript 1.5|JScript 5.5|ECMAScript v3

name : String Specifies the type of exception. | Show Details | 5.0+ | 1.0+ | 6.0+ | no | no

Availability

  JavaScript 1.5|JScript 5.5|ECMAScript v3

## Inherited Functions

Method | Action | IE | Mozilla | Netscape | Opera | Safari
--- | --- | --- | --- | --- | --- | ---
toString() : String Converts an Error object to a string. | Show Details | 5.0+ | 1.0+ | 6.0+ | 7.0+ | 1.0+

Returns

String |

Availability

  JavaScript 1.5|JScript 5.5|ECMAScript v3

## 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 <new> 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

text_javascript aptana_docs