Represents an error when trying to interpret syntactically invalid code.
new SyntaxError([message[, fileName[, lineNumber]]])
- Human-readable description of the error
- The name of the file containing the code that caused the exception
- The line number of the code that caused the exception
For properties available on
SyntaxError Redirect 1 instances, see Properties of SyntaxError Redirect 1 instances.
- Allows the addition of properties to an SyntaxError object.
For methods available on
SyntaxError Redirect 1 instances, see Methods of SyntaxError Redirect 1 instances.
SyntaxError contains no methods of its own, however, it does inherit some methods through the prototype chain.
All SyntaxError instances inherit from SyntaxError.prototype. You can use the prototype to add properties or methods to all instances.
SyntaxErrorshould provide its own
messageproperty, in SpiderMonkey, it inherits Error.prototype.message.
SyntaxError prototype object does not contain any methods of its own,
SyntaxError instances do inherit some methods through the prototype chain.