File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -106,14 +106,14 @@ s.x // undefined
106
106
107
107
另一方面,调用结束后,临时对象会自动销毁。这意味着,下一次调用字符串的属性时,实际是调用一个新生成的对象,而不是上一次调用时生成的那个对象,所以取不到赋值在上一个对象的属性。如果想要为字符串添加属性,只有在它的原型对象` String.prototype ` 上定义(参见《面向对象编程》一章)。
108
108
109
- 这种原始类型值可以直接调用的方法还有很多(详见后文对各包装对象的介绍),除了前面介绍过的` valueOf ` 和` toString ` 方法,还包括三个包装对象各自定义在实例上的方法 。。
109
+ 这种原始类型值可以直接调用的方法还有很多(详见后文对各包装对象的介绍),除了前面介绍过的` valueOf ` 和` toString ` 方法,还包括三个包装对象各自定义在原型上的方法 。。
110
110
111
111
``` javascript
112
112
' abc' .charAt === String .prototype .charAt
113
113
// true
114
114
```
115
115
116
- 上面代码表示,字符串` abc ` 的` charAt ` 方法,实际上就是定义在` String ` 对象实例上的方法 (关于` prototype ` 对象的介绍参见《面向对象编程》一章)。
116
+ 上面代码表示,字符串` abc ` 的` charAt ` 方法,实际上就是定义在` String ` 对象原型上的方法 (关于` prototype ` 对象的介绍参见《面向对象编程》一章)。
117
117
118
118
如果包装对象与原始类型值进行混合运算,包装对象会转化为原始类型(实际是调用自身的` valueOf ` 方法)。
119
119
You can’t perform that action at this time.
0 commit comments