From 0b247a9ea2c59aa594193b3d359b328f5bc4d0fc Mon Sep 17 00:00:00 2001 From: Yang KeAn Date: Sun, 8 Jan 2017 10:52:44 +0800 Subject: [PATCH] =?UTF-8?q?9.=E5=AF=B9=E8=B1=A1=E7=9A=84=E6=89=A9=E5=B1=95?= =?UTF-8?q?=20=E6=96=B9=E6=B3=95=E7=9A=84name=E5=B1=9E=E6=80=A7=E9=83=A8?= =?UTF-8?q?=E5=88=86=E9=9C=80=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在 http://es6.ruanyifeng.com/#docs/object#方法的-name-属性 中,“console.log(this.name)” 不应该出现,这里的“this”指代的是方法所处的对象,即 person,该对象并不存在 name 属性,与本节所讲方法的属性毫无关系,易引起误导,应修改。 --- docs/object.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/object.md b/docs/object.md index 2cd2b4c..bbf578e 100644 --- a/docs/object.md +++ b/docs/object.md @@ -246,7 +246,7 @@ myObject // Object {[object Object]: "valueB"} ```javascript const person = { sayName() { - console.log(this.name); +    console.log('hello!'); }, };