Skip to content

Commit 0ad6b4e

Browse files
authored
Update class.md
1 parent ec830de commit 0ad6b4e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/class.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,7 @@ Foo.classMethod() // 'hello'
876876

877877
var foo = new Foo();
878878
foo.classMethod()
879-
// TypeError: undefined is not a function
879+
// TypeError: foo.classMethod is not a function
880880
```
881881
882882
上面代码中,`Foo`类的`classMethod`方法前有`static`关键字,表明该方法是一个静态方法,可以直接在`Foo`类上调用(`Foo.classMethod()`),而不是在`Foo`类的实例上调用。如果在实例上调用静态方法,会抛出一个错误,表示不存在该方法。

0 commit comments

Comments
 (0)