Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

SyntaxError.prototype

概览

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. Standard Initial definition.
ECMAScript 5.1 (ECMA-262)
NativeError.prototype
Standard Defined as NativeError.prototype.
ECMAScript 6 (ECMA-262)
NativeError.prototype
Release Candidate 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)

相关链接

文档标签和贡献者

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