- reduce 接收俩个参数:(用来reduce的函数,计算结果的初始值)
let letters = ["r", "e", "d", "u", "e", "r"];
let word = letters.reduce((accumulatedResult, arrayItem) => {
console.log(accumulatedResult, "-----", arrayItem);
return accumulatedResult + arrayItem;
}, "");
let letters = ["r", "e", "d", "u", "e", "r"];
let word = letters.reduce((accumulatedResult, arrayItem) => {
console.log(accumulatedResult, "-----", arrayItem);
return accumulatedResult + arrayItem;
}, "");