语法错误

// reduce方法
[1,,2].reduce((x,y) => return x+y) // 3
修改后
[1,,2].reduce((x,y) => x+y) // 3
This commit is contained in:
leolcy
2018-07-24 18:10:53 +08:00
committed by GitHub
parent 3034d8e4ed
commit e423f4967f
+1 -1
View File
@@ -777,7 +777,7 @@ ES5 对空位的处理,已经很不一致了,大多数情况下会忽略空
[,'a'].every(x => x==='a') // true
// reduce方法
[1,,2].reduce((x,y) => return x+y) // 3
[1,,2].reduce((x,y) => x+y) // 3
// some方法
[,'a'].some(x => x !== 'a') // false