Last active
December 28, 2017 10:13
-
-
Save lushijie/acfd6c86226c11a4e17923f614a860b1 to your computer and use it in GitHub Desktop.
array-reduce 携带初始值
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// reduce方法 | |
let arr = [1, 2, 3, 4, 5, 6]; | |
let reduceResult = arr.reduce((x, y) => { | |
return x + y | |
}, 123); | |
console.log(reduceResult); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment