InternalError
Non-standard: This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.
InternalError
对象指示 JavaScript 引擎内部发生的错误。
¥The InternalError
object indicates an error that occurred internally in the JavaScript engine.
示例情况大多是当某些东西太大时,例如:
¥Example cases are mostly when something is too large, e.g.:
- "开关盒太多",
- "正则表达式中的括号过多",
- "数组初始值设定项太大",
- "太多的递归"。
InternalError
是 Error
的子类。
¥InternalError
is a subclass of Error
.
构造函数
实例属性
¥Instance properties
还从其父级 Error
继承实例属性。
¥Also inherits instance properties from its parent Error
.
这些属性在 InternalError.prototype
上定义并由所有 InternalError
实例共享。
¥These properties are defined on InternalError.prototype
and shared by all InternalError
instances.
InternalError.prototype.constructor
-
创建实例对象的构造函数。对于
InternalError
实例,初始值为InternalError
构造函数。 InternalError.prototype.name
-
表示错误类型的名称。对于
InternalError.prototype.name
,初始值为"InternalError"
。
实例方法
示例
递归过多
¥Too much recursion
根据退出条件,此递归函数运行 10 次。
¥This recursive function runs 10 times, as per the exit condition.
function loop(x) {
// "x >= 10" is the exit condition
if (x >= 10) return;
// do stuff
loop(x + 1); // the recursive call
}
loop(0);
将此条件设置为极高的值可能不起作用:
¥Setting this condition to an extremely high value, may not work:
function loop(x) {
if (x >= 1000000000000) return;
// do stuff
loop(x + 1);
}
loop(0);
// InternalError: too much recursion
欲了解更多信息,请参阅 内部错误:太多的递归。
¥For more information, see InternalError: too much recursion.
规范
浏览器兼容性
BCD tables only load in the browser
也可以看看
¥See also