SyntaxError : Error

A SyntaxError is thrown if there is a syntax error in the JavaScript code.

Browser/User Agent Support

IEMozillaNetscapeOperaSafari
5.0+1.0+6.0+nono

Constructors

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

Properties

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

Remarks

Can be thrown by the method, constructor, and the constructor.

References

Error | Error.message | Error.name

Availability

JavaScript 1.5 | JScript 5.5 | ECMAScript v3

Constructor Detail

 SyntaxError SyntaxError([String message])

Creates a new instance of SyntaxError.

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

Property Detail

String message

An error message associated with the SyntaxError.

Remarks
Contains either the error message passed to the constructor, or a default message.
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