@@ -958,23 +958,23 @@ console.log(obj); // fun { a: 3, b: 5 }
958958
959959** 【第一步:函数体内会自动创建出一个空白对象】**
960960
961- ![ ] ( mark- img/734f6064b1274f0ba011d8a7a8e7dfd4 .png)
961+ ![ ] ( https:// img-blog.csdnimg.cn/direct/5e395094543a4eb4ae61ff6dac073edd .png)
962962
963963** 【第二步:函数的上下文(this)会指向这个对象】**
964964
965- ![ ] ( mark- img/2346ce01c7264015a9890fd2317e01e1 .png)
965+ ![ ] ( https:// img-blog.csdnimg.cn/direct/7012d7cbfc684f659bec17d87b0691d4 .png)
966966
967967** 【第三步:执行函数体中的语句】**
968968
969969> 之后这个对象就不再是空对象了。
970970
971- ![ ] ( mark-img/image-20220211181748464 .png)
971+ ![ ] ( https://img-blog.csdnimg.cn/direct/0eb03ca94ca1462e89dd0a15663960c8 .png)
972972
973973** 【第四步:函数会自动返回上下文对象,即使函数没有 return 语句】**
974974
975975> 执行结果为:{a: 3, b: 5}
976976
977- ![ ] ( mark- img/3aab18d93cc04d0a82ce3db482135cd1 .png)
977+ ![ ] ( https:// img-blog.csdnimg.cn/direct/31d09ff702594b41b6e9192953e900bc .png)
978978
979979【案例】
980980
@@ -1098,15 +1098,15 @@ say();
10981098
10991099# 九、类与实例
11001100
1101- <img src =" mark- img/0c5272275c614edaa9bb5698780bffff .png" style =" width :60% ;" />
1101+ <img src =" https:// img-blog.csdnimg.cn/direct/fa02cda6b88041a28c70bb6f349d25dd .png" style =" width :60% ;" />
11021102
11031103【类好比是 “蓝图”】
11041104
11051105如同 “蓝图” 一样,类只描述对象会拥有哪些属性和方法,但是并不具体指明属性的值。
11061106
11071107【实例是具体的对象】
11081108
1109- <img src =" mark- img/ac0233152c1c4be08ac08fefa0a77e73 .png" style =" width :60% ;" />
1109+ <img src =" https:// img-blog.csdnimg.cn/direct/0d966eddfca848e09e6f4adde374db19 .png" style =" width :60% ;" />
11101110
11111111【构造函数和 “类”】
11121112
@@ -1130,7 +1130,7 @@ prototype 属性值是个对象,同时该对象默认拥有 constructor 属性
11301130
11311131> constructor:制造商
11321132
1133- <img src =" mark- img/52a1d4d63a1f469eb4c3ef508e2de141 .png" style =" width :50% ;" />
1133+ <img src =" https:// img-blog.csdnimg.cn/direct/5322febe554a416486ac0a47ae734127 .png" style =" width :50% ;" />
11341134
11351135``` javascript
11361136function sum (a , b ) {
@@ -1156,7 +1156,7 @@ true
11561156
11571157## 10.2 构造函数的prototype是实例对象的原型
11581158
1159- <img src =" mark- img/2d1fb514299f49e69428be08ea7d9b07 .png" style =" width :60% ;" />
1159+ <img src =" https:// img-blog.csdnimg.cn/direct/adf875daf34446298a47d1d1c12146e8 .png" style =" width :60% ;" />
11601160
11611161` People.prototype ` 是 ` xiaoming ` 的原型。
11621162
@@ -1195,7 +1195,7 @@ var xiaoming = new People('小明', 12, '男');
11951195console .log (xiaoming .nationality ); // 中国
11961196```
11971197
1198- <img src =" mark- img/332b6b06736d4a59b6f2df9a7f42d52e .png" style =" width :60% ;" />
1198+ <img src =" https:// img-blog.csdnimg.cn/direct/667ae6851e8b4cddb8959d4c1c01d4ea .png" style =" width :60% ;" />
11991199
12001200【遮蔽效应】
12011201
@@ -1217,7 +1217,7 @@ tom.nationality = '美国';
12171217console .log (tom .nationality ); // 美国
12181218```
12191219
1220- <img src =" mark- img/eb7937d314024951922741fe0b0a3d97 .png" style =" width :60% ;" />
1220+ <img src =" https:// img-blog.csdnimg.cn/direct/1bc6a0f28f1e4ed58bc882006fad5c0d .png" style =" width :60% ;" />
12211221
12221222## 10.4 hasOwnProperty
12231223
@@ -1259,15 +1259,15 @@ function People(name, age, sex) {
12591259}
12601260```
12611261
1262- <img src =" mark- img/faf93b02816b4912a72ca2f09ad4760a .png" style =" width :60% ;" />
1262+ <img src =" https:// img-blog.csdnimg.cn/direct/79a08d422e504f30ade5b5c4317cdc4c .png" style =" width :60% ;" />
12631263
12641264把方法直接添加到实例身上的缺点:每个实例和每个实例的方法函数都是内存中不同的函数,造成了内存的浪费。
12651265
12661266解决办法:将方法写到 prototype 上。
12671267
12681268## 11.2 方法要写到prototype上
12691269
1270- <img src =" mark- img/a2ddf61a4d254ed59ee4a5b34b23001a .png" style =" width :60% ;" />
1270+ <img src =" https:// img-blog.csdnimg.cn/direct/ac0247768b794cc18d7a4e1c4c98ceef .png" style =" width :60% ;" />
12711271
12721272``` javascript
12731273function People (name , age , sex ) {
@@ -1304,7 +1304,7 @@ Object 可以看做是所有对象的构造函数。
13041304
13051305所以,People.prototype 这个对象可以看做是 Object new 出来的。
13061306
1307- <img src =" mark- img/29344d84587445a3a94a354a95e998d0 .png" style =" width :60% ;" />
1307+ <img src =" https:// img-blog.csdnimg.cn/direct/510e2223bd8b47beb17e150c91ea046d .png" style =" width :60% ;" />
13081308
13091309``` javascript
13101310function People () {
@@ -1321,17 +1321,17 @@ console.log(Object.prototype.__proto__); // null
13211321
13221322任何数组实际上都是可以看做是 Array 这个构造函数 new 出来的。
13231323
1324- <img src =" mark- img/4605f0ce53db4bf6a87dbb9032487e24 .png" style =" width :60% ;" />
1324+ <img src =" https:// img-blog.csdnimg.cn/direct/0c1f0d8a42994cf5b3bf9fdb77c857ea .png" style =" width :60% ;" />
13251325
13261326# 十三、继承
13271327
13281328## 13.1 两个无关类
13291329
1330- <img src =" mark-img/image-20220211233520473 .png" style =" width : 50% ;" />
1330+ <img src =" https://img-blog.csdnimg.cn/direct/e6342561c8014bf1b95a9d57c29927e6 .png" style =" width : 50% ;" />
13311331
13321332## 13.2 两个有关类
13331333
1334- <img src =" mark-img/image-20220211233716935 .png" style =" width :50% ;" />
1334+ <img src =" https://img-blog.csdnimg.cn/direct/f20e9a9c6fb94249a40d5fc9f52a0f88 .png" style =" width :50% ;" />
13351335
13361336## 13.3 People类和Student类的关系
13371337
@@ -1347,7 +1347,7 @@ console.log(Object.prototype.__proto__); // null
13471347- People 是 “父类”(或 “超类”、“基类”),Student 是 “子类”(或 “派生类”)
13481348- 子类丰富了父类,让类描述得更加具体化、更细化
13491349
1350- <img src =" mark-img/image-20220211234613187 .png" style =" width :50% ;" />
1350+ <img src =" https://img-blog.csdnimg.cn/direct/4732b119f09f42a894de41080215fc9d .png" style =" width :50% ;" />
13511351
13521352## 13.5 JavaScript中如何实现继承
13531353
@@ -1357,7 +1357,7 @@ console.log(Object.prototype.__proto__); // null
13571357
13581358## 13.6 通过原型链实现继承
13591359
1360- <img src =" mark-img/image-20220212014641115 .png" style =" width : 60% ;" />
1360+ <img src =" https://img-blog.csdnimg.cn/direct/9a35d8e861c54c5aa2d699c9192c6c2b .png" style =" width : 60% ;" />
13611361
13621362** 原理:子类构造函数的 prototype 直接指向父类的实例!**
13631363
@@ -1509,19 +1509,19 @@ jerry.sleep();
15091509</html >
15101510```
15111511
1512- <img src =" mark- img/231234234123.gif " style =" width :60% ;" />
1512+ <img src =" https:// img-blog.csdnimg.cn/direct/f3cbe5db7f0147d2b2b4aeb6bf3b150b.png " style =" width :60% ;" />
15131513
15141514## 14.2 小案例:炫彩小球
15151515
15161516【Ball 类】
15171517
1518- <img src =" mark-img/image-20220212122635036 .png" style =" width :50% ;" />
1518+ <img src =" https://img-blog.csdnimg.cn/direct/f57f97b9f6ff45889d7f34814d087689 .png" style =" width :50% ;" />
15191519
1520- <img src =" mark-img/image-20220212122701973 .png" style =" width :50% ;" />
1520+ <img src =" https://img-blog.csdnimg.cn/direct/0ddbfbdf45034801a933e1f878781dae .png" style =" width :50% ;" />
15211521
15221522** 如何实现多个小球动画?**
15231523
1524- <img src =" mark-img/image-20220212122934563 .png" style =" width :50% ;" />
1524+ <img src =" https://img-blog.csdnimg.cn/direct/56db9d5b9cd2444cb71ca2f320193858 .png" style =" width :50% ;" />
15251525
15261526``` html
15271527<!DOCTYPE html>
@@ -1638,7 +1638,7 @@ jerry.sleep();
16381638</html >
16391639```
16401640
1641- <img src =" mark- img/124123412341234123.gif " style =" width :60% ;" />
1641+ <img src =" https:// img-blog.csdnimg.cn/direct/21c942be75e442f79c3086d8b3052945.png " style =" width :60% ;" />
16421642
16431643# 十五、包装类
16441644
@@ -1674,7 +1674,7 @@ console.log(e.__proto__ == String.prototype); // true
16741674
16751675a、b、c 是基本类型值吗?它们和普通的数字、字符串、布尔值有什么区别?
16761676
1677- <img src =" mark-img/image-20220212162000631 .png" style =" width :30% ;" />
1677+ <img src =" https://img-blog.csdnimg.cn/direct/503c97eb7c8349b08184ac6154492991 .png" style =" width :30% ;" />
16781678
16791679## 15.2 总结
16801680
@@ -1714,7 +1714,7 @@ console.log(Math.round(3.98)); // 4
17141714console .log (Math .round (3.49 )); // 3
17151715```
17161716
1717- <img src =" mark-img/image-20220212163342374 .png" style =" width :60% ;" />
1717+ <img src =" https://img-blog.csdnimg.cn/direct/4176ee31c85d4c45836be0f51106552f .png" style =" width :60% ;" />
17181718
17191719``` javascript
17201720var a = 3.7554 ;
0 commit comments