ReferenceError.prototype
表示 ReferenceError
的原型构造器。
ReferenceError.prototype 属性的属性特性: |
|
---|---|
writable | false |
enumerable | false |
configurable | false |
描述
所有ReferenceError
实例都继承自 ReferenceError.prototype
. 你可以使用原型来为所有实例添加属性和方法。
属性
-
ReferenceError.prototype.constructor
- 创建一个实例原型的函数。
-
ReferenceError.prototype.message
-
错误信息。尽管ECMA-262 曾表示
ReferenceError
应该提供自己的message
属性, 在 SpiderMonkey 中, 它继承自Error.prototype.message
. -
ReferenceError.prototype.name
-
错误名称. 继承自
Error
. -
ReferenceError.prototype.fileName
-
出现这个错误的路径. 继承自
Error
. -
ReferenceError.prototype.lineNumber
-
出现这个错误的行号. 继承自
Error
. -
ReferenceError.prototype.columnNumber
-
出现这个错误的列号. 继承自
Error
. -
ReferenceError.prototype.stack
-
堆栈追踪. 继承自
Error
.
方法
尽管 ReferenceError
实例确实从原型链中继承了一些方法。
规格
规格版本 | 状态 | 注释 |
---|---|---|
ECMAScript 3rd Edition (ECMA-262) | Standard | 初始定义 |
ECMAScript 5.1 (ECMA-262) NativeError.prototype |
Standard | Defined as |
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 . |
浏览器兼容性
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out
https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | Server | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ReferenceError |
Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 5.5 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
Legend
- Full support
- Full support