Skip to content

Instantly share code, notes, and snippets.

@lushijie
Last active December 28, 2017 10:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lushijie/acfd6c86226c11a4e17923f614a860b1 to your computer and use it in GitHub Desktop.
Save lushijie/acfd6c86226c11a4e17923f614a860b1 to your computer and use it in GitHub Desktop.
array-reduce 携带初始值
// 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