Skip to content

Commit 3dcf078

Browse files
committed
edit destructuring & class
1 parent f05acc0 commit 3dcf078

File tree

3 files changed

+3
-22
lines changed

3 files changed

+3
-22
lines changed

docs/class.md

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -793,27 +793,7 @@ var descriptor = Object.getOwnPropertyDescriptor(
793793
"set" in descriptor // true
794794
```
795795
796-
上面代码中,存值函数和取值函数是定义在html属性的描述对象上面,这与ES5完全一致。
797-
798-
下面的例子针对所有属性,设置存值函数和取值函数。
799-
800-
```javascript
801-
class Jedi {
802-
constructor(options = {}) {
803-
// ...
804-
}
805-
806-
set(key, val) {
807-
this[key] = val;
808-
}
809-
810-
get(key) {
811-
return this[key];
812-
}
813-
}
814-
```
815-
816-
上面代码中,Jedi实例所有属性的存取,都会通过存值函数和取值函数。
796+
上面代码中,存值函数和取值函数是定义在`html`属性的描述对象上面,这与ES5完全一致。
817797
818798
## Class的Generator方法
819799

docs/destructuring.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ start // error: start is undefined
286286
let obj = {};
287287
let arr = [];
288288

289-
({ foo: obj.prop, bar: arr[0] }) = { foo: 123, bar: true };
289+
({ foo: obj.prop, bar: arr[0] } = { foo: 123, bar: true });
290290

291291
obj // {prop:123}
292292
arr // [true]

docs/reference.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
- Benjamin De Cock, [Frontend Guidelines](https://github.com/bendc/frontend-guidelines): ES6最佳实践
2828
- Jani Hartikainen, [ES6: What are the benefits of the new features in practice?](http://codeutopia.net/blog/2015/01/06/es6-what-are-the-benefits-of-the-new-features-in-practice/)
2929
- kangax, [Javascript quiz. ES6 edition](http://perfectionkills.com/javascript-quiz-es6/): ES6小测试
30+
- Jeremy Fairbank, [HTML5DevConf ES7 and Beyond!](https://speakerdeck.com/jfairbank/html5devconf-es7-and-beyond): ES7新增语法点介绍
3031

3132
## let和const
3233

0 commit comments

Comments
 (0)