RangeError.prototype

 
RangeError.prototype 属性表示 RangeError 构造函数的原型。
 
RangeError.prototype 属性的属性特性:
writable false
enumerable false
configurable false

描述

所有  RangeError 的实例都继承自 RangeError.prototype ,所以你可以使用这个属性来为所有的实例添加属性或方法。

属性

RangeError.prototype.constructor
指定了创建实例原型的函数
RangeError.prototype.message
错误信息。尽管 ECMA-262 规定了 RangeError 应该拥有一个 message 属性,但在 SpiderMonkey 中,该属性继承自 Error.prototype.message
RangeError.prototype.name
错误名字,继承自 Error
RangeError.prototype.fileName
引起该错误的文件路径,继承自 Error
RangeError.prototype.lineNumber
引起该错误的行号,继承自 Error
RangeError.prototype.columnNumber
引起该错误的列号,继承自 Error
RangeError.prototype.stack
堆栈跟踪记录,继承自 Error

方法

尽管 RangeError 实例却通过原型链继承到了一些方法。

Specifications

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.

Browser compatibility

Update compatibility data on GitHub
Desktop Mobile Server
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet Node.js
RangeError 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

See also