A SyntaxError is thrown if there is a syntax error in the JavaScript code.
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 SyntaxError. | 5.0+ | 1.0+ | 6.0+ | no | no |
Properties
| Property | IE | Mozilla | Netscape | Opera | Safari |
|---|---|---|---|---|---|
An error message associated with the SyntaxError. | 5.0+ | 1.0+ | 6.0+ | no | no |
Specifies the type of exception. | 5.0+ | 1.0+ | 6.0+ | no | no |
Remarks
Can be thrown by the
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.
| String | message | Error 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
- 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