1
0
mirror of https://github.com/ruanyf/es6tutorial.git synced 2025-05-25 03:02:21 +00:00

语法错误

// 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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -777,7 +777,7 @@ ES5 对空位的处理,已经很不一致了,大多数情况下会忽略空
[,'a'].every(x => x==='a') // true [,'a'].every(x => x==='a') // true
// reduce方法 // reduce方法
[1,,2].reduce((x,y) => return x+y) // 3 [1,,2].reduce((x,y) => x+y) // 3
// some方法 // some方法
[,'a'].some(x => x !== 'a') // false [,'a'].some(x => x !== 'a') // false