Skip to content

Commit 41efa95

Browse files
committed
Merge branch 'gh-pages' of github.com:ruanyf/es6tutorial into gh-pages
2 parents 22c3b93 + 67416c0 commit 41efa95

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

docs/array.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ Array(3) // [, , ,]
728728

729729
ES5 对空位的处理,已经很不一致了,大多数情况下会忽略空位。
730730

731-
- `forEach()`, `filter()`, `every()``some()`都会跳过空位。
731+
- `forEach()`, `filter()`, `reduce()`, `every()``some()`都会跳过空位。
732732
- `map()`会跳过空位,但会保留这个值
733733
- `join()``toString()`会将空位视为`undefined`,而`undefined``null`会被处理成空字符串。
734734

@@ -742,6 +742,9 @@ ES5 对空位的处理,已经很不一致了,大多数情况下会忽略空
742742
// every方法
743743
[,'a'].every(x => x==='a') // true
744744

745+
// reduce方法
746+
[1,,2].reduce((x,y) => return x+y) // 3
747+
745748
// some方法
746749
[,'a'].some(x => x !== 'a') // false
747750

0 commit comments

Comments
 (0)