Skip to content

Commit 0199e31

Browse files
committed
docs(array): fix type
1 parent c25565b commit 0199e31

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

docs/array.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ ES5对空位的处理,已经很不一致了,大多数情况下会忽略空
414414

415415
```javascript
416416
// forEach方法
417-
[,'a'].forEach((x,i) => log(i)); // 1
417+
[,'a'].forEach((x,i) => console.log(i)); // 1
418418

419419
// filter方法
420420
['a',,'b'].filter(x => true) // ['a','b']

docs/object.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,11 @@ function* entries(obj) {
873873

874874
// 非Generator函数的版本
875875
function entries(obj) {
876-
return (for (key of Object.keys(obj)) [key, obj[key]]);
876+
let arr = [];
877+
for (key of Object.keys(obj)) {
878+
arr.push([key, obj[key]]);
879+
}
880+
return arr;
877881
}
878882
```
879883

0 commit comments

Comments
 (0)