We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS

SyntaxError.prototype 属性表示SyntaxError 构造器的原型.

描述

所有 SyntaxError 实例继承自 SyntaxError.prototype. 你可以使用该原型给所有实例添加属性和方法.

属性

SyntaxError.prototype.constructor
创建实例的构造函数.
SyntaxError.prototype.message
错误信息. 尽管 ECMA-262 指出, SyntaxError 应该提供其子什么的信息属性,但在 SpiderMonkey 中, 仍是继承自Error.prototype.message.
SyntaxError.prototype.name
错误的名称.继承自 Error.
SyntaxError.prototype.fileName
抛出该异常的文件路径.继承自 Error.
SyntaxError.prototype.lineNumber
抛出该异常的文件的行号. 继承自 Error.
SyntaxError.prototype.columnNumber
抛出该异常的文件的列数. 继承自 Error.
SyntaxError.prototype.stack
栈追踪信息. 继承自 Error.

方法

尽管 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.

浏览器兼容性

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

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)

相关链接

文档标签和贡献者

此页面的贡献者: Ende93, yenshen
最后编辑者: Ende93,