diff --git a/docs/object.md b/docs/object.md index 22476e0..e4c77b0 100644 --- a/docs/object.md +++ b/docs/object.md @@ -701,18 +701,19 @@ Object.keys(obj) 目前,ES7有一个[提案](https://github.com/tc39/proposal-object-values-entries),引入了跟`Object.keys`配套的`Object.values`和`Object.entries`。 ```javascript + let {keys, values, entries} = Object; let obj = { a: 1, b: 2, c: 3 }; for (let key of keys(obj)) { - // ['a', 'b', 'c'] + console.log(key); // 'a', 'b', 'c' } for (let value of values(obj)) { - // [1, 2, 3] + console.log(value); // 1, 2, 3 } for (let [key, value] of entries(obj)) { - // [['a', 1], ['b', 2], ['c', 3]] + console.log([key, value]); // ['a', 1], ['b', 2], ['c', 3] } ``` @@ -739,7 +740,7 @@ Object.values(obj) `Object.values`只返回对象自身的可遍历属性。 ```javascript -var obj = Object.create({}, {p: 42}); +var obj = Object.create({}, {p: {value: 42}}); Object.values(obj) // [] ``` diff --git a/docs/reference.md b/docs/reference.md index 2e8150b..4f4d746 100644 --- a/docs/reference.md +++ b/docs/reference.md @@ -35,6 +35,7 @@ - kangax, [Why typeof is no longer “safe”](http://es-discourse.com/t/why-typeof-is-no-longer-safe/15): 讨论在块级作用域内,let命令的变量声明和赋值的行为 - Axel Rauschmayer, [Variables and scoping in ECMAScript 6](http://www.2ality.com/2015/02/es6-scoping.html): 讨论块级作用域与let和const的行为 - Nicolas Bevacqua, [ES6 Let, Const and the “Temporal Dead Zone” (TDZ) in Depth](http://ponyfoo.com/articles/es6-let-const-and-temporal-dead-zone-in-depth) +- acorn, [Function statements in strict mode](https://github.com/ternjs/acorn/issues/118): 块级作用域对严格模式的函数声明的影响 ## 解构赋值