Error.prototype
Error.prototype
属性代表 Error
的构造器。
| Error.prototype
属性的属性特性: |
|:----|
| Writable | no |
| Enumerable | no |
| Configurable | no |
描述
属性
标准属性
厂商特定扩展属性
非标准
该特性是非标准的,请尽量不要在生产环境中使用它!
Microsoft
Error.prototype.description
错误描述,与 message
相似。
Mozilla
Error.prototype.fileName
产生该错误的文件名。
Error.prototype.lineNumber
产生该错误的行号。
Error.prototype.columnNumber
产生该错误的列号。
方法
Error.prototype.toSource()
返回一个包含特定 Error
对象的源代码字符串,你可以用该值新建一个新的对象,重写自 Object.prototype.toSource()
方法。
Error.prototype.toString()
返回一个表示该对象的字符串,重写自 Object.prototype.toString()
方法。
规范
Specification | Status | Comment |
---|---|---|
ECMAScript 1st Edition (ECMA-262) | Standard | Initial definition. Implemented in JavaScript 1.1. |
ECMAScript 5.1 (ECMA-262)The definition of 'Error' in that specification. | Standard | |
ECMAScript 2015 (6th Edition, ECMA-262)The definition of 'Error' in that specification. | Standard | |
ECMAScript Latest Draft (ECMA-262)The definition of 'Error' in that specification. | Living Standard | |
浏览器兼容性
Feature | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic Support | (Yes) | (Yes) | (Yes) | 6 | (Yes) | (Yes) |
Feature | Android | Chrome for Android | Edge mobile | Firefox for Android | IE mobile | Opera Android | iOS Safari |
---|---|---|---|---|---|---|---|
Basic Support | (Yes) | (Yes) | (Yes) | (Yes) | 8.1 | (Yes) | (Yes) |
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com