SyntaxError.prototype 属性表示SyntaxError 构造器的原型.
所有 SyntaxError 实例继承自 SyntaxError.prototype. 你可以使用该原型给所有实例添加属性和方法.
SyntaxError.prototype.constructorSyntaxError.prototype.messageSyntaxError 应该提供其子什么的信息属性,但在 SpiderMonkey 中, 仍是继承自Error.prototype.message.SyntaxError.prototype.nameError.SyntaxError.prototype.fileNameError.SyntaxError.prototype.lineNumberError.SyntaxError.prototype.columnNumberError.SyntaxError.prototype.stackError.尽管 SyntaxError 原型对象自身不包含任何方法,但 SyntaxError 实例从原型链中继承了一些方法.
| Specification | Status | Comment |
|---|---|---|
| ECMAScript 3rd Edition (ECMA-262) | Standard | Initial definition. |
| ECMAScript 5.1 (ECMA-262) NativeError.prototype |
Standard | Defined as NativeError.prototype. |
| ECMAScript 2015 (6th Edition, ECMA-262) NativeError.prototype |
Standard | Defined as NativeError.prototype. |
| ECMAScript Latest Draft (ECMA-262) NativeError.prototype |
Draft | Defined as NativeError.prototype. |
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|
| Basic support | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |
| Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|---|
| Basic support | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) |