Skip to content

Commit ac09300

Browse files
committed
docs(feat/error): edit text
1 parent 6ff80f2 commit ac09300

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/features/error.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ var err = new Error('出错了');
99
err.message // "出错了"
1010
```
1111

12-
上面代码中,我们调用`Error`构造函数,生成一个实例对象`err``Error`构造函数接受一个参数,表示错误提示,可以从实例的`message`属性读到这个参数。抛出`Error`实例对象以后,整个程序就中断在发生错误的地方,不再往下执行。
12+
上面代码中,我们调用`Error()`构造函数,生成一个实例对象`err``Error()`构造函数接受一个参数,表示错误提示,可以从实例的`message`属性读到这个参数。抛出`Error`实例对象以后,整个程序就中断在发生错误的地方,不再往下执行。
1313

1414
JavaScript 语言标准只提到,`Error`实例对象必须有`message`属性,表示出错时的提示信息,没有提到其他属性。大多数 JavaScript 引擎,对`Error`实例还提供`name``stack`属性,分别表示错误的名称和错误的堆栈,但它们是非标准的,不是每种实现都有。
1515

@@ -105,7 +105,7 @@ new Array(-1)
105105

106106
```javascript
107107
new 123
108-
// Uncaught TypeError: number is not a func
108+
// Uncaught TypeError: 123 is not a constructor
109109

110110
var obj = {};
111111
obj.unknownMethod()

0 commit comments

Comments
 (0)