docs(array): fix type

This commit is contained in:
ruanyf
2016-07-04 06:25:28 +08:00
parent c25565b70c
commit 0199e3182d
2 changed files with 6 additions and 2 deletions
+1 -1
View File
@@ -414,7 +414,7 @@ ES5对空位的处理,已经很不一致了,大多数情况下会忽略空
```javascript
// forEach方法
[,'a'].forEach((x,i) => log(i)); // 1
[,'a'].forEach((x,i) => console.log(i)); // 1
// filter方法
['a',,'b'].filter(x => true) // ['a','b']
+5 -1
View File
@@ -873,7 +873,11 @@ function* entries(obj) {
// 非Generator函数的版本
function entries(obj) {
return (for (key of Object.keys(obj)) [key, obj[key]]);
let arr = [];
for (key of Object.keys(obj)) {
arr.push([key, obj[key]]);
}
return arr;
}
```