From 99c8f91eb393afe2cef7c1a398a98c72676a8bac Mon Sep 17 00:00:00 2001 From: LiuC123 Date: Thu, 21 Feb 2019 11:10:00 +0800 Subject: [PATCH] Update understand-prototype-__proto__.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 一个错别字 --- points/understand-prototype-__proto__.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/points/understand-prototype-__proto__.md b/points/understand-prototype-__proto__.md index fac5eb9..6bb0c62 100644 --- a/points/understand-prototype-__proto__.md +++ b/points/understand-prototype-__proto__.md @@ -83,7 +83,7 @@ ![2](http://angular.angular-china.org/cbe213bb-6f1e-4fc5-84d4-fa082bf50a89.jpg) + 接下来`var car = new Car('porsche')`这一行代码可不像它看起来那样,它内部的实现还是有许多值得玩味的; 首先,函数`Car`创建了一个新的对象(a),**这个对象有一个隐藏的属性`__proto__`,这个属性和`Car`的原型都指向同一个对象.** - 然后`Car`函数内部的`this`指向哪个新创建的对象(a).如下图所示: + 然后`Car`函数内部的`this`指向那个新创建的对象(a).如下图所示: ![3](http://angular.angular-china.org/6441a0ee-2acd-4667-82b7-8d8a7b57f188.jpg) + 然后我们给这个对象添加了一个属性`name`,并且为其赋值.**还要注意的一点是,我们这个`Car`函数是有返回值的,虽然没有使用`return`关键字 把这个值显式的返回**,这个返回值是一个引用,然后变量`car`就可以用来操作那个对象了(a). @@ -147,4 +147,4 @@ -[1]:http://pythontutor.com/visualize.html#code=console.log%28%7B%7D.__proto__%29;%0Aconsole.log%28%28function%28%29%7B%7D%29.prototype%29;&mode=display&origin=opt-frontend.js&cumulative=false&heapPrimitives=false&textReferences=false&py=js&rawInputLstJSON=%5B%5D&curInstr=2 \ No newline at end of file +[1]:http://pythontutor.com/visualize.html#code=console.log%28%7B%7D.__proto__%29;%0Aconsole.log%28%28function%28%29%7B%7D%29.prototype%29;&mode=display&origin=opt-frontend.js&cumulative=false&heapPrimitives=false&textReferences=false&py=js&rawInputLstJSON=%5B%5D&curInstr=2