admin 發表於 2022-11-24 19:14:51

JS : .reduce() Method

const newNumbers = ;

const newSum = newNumbers.reduce((accumulator, currentValue) => {
console.log('The value of accumulator: ', accumulator);
console.log('The value of currentValue: ', currentValue);
return accumulator + currentValue;
}, 10);
console.log(newSum);這是 .reduce() 方法。
頁: [1]
查看完整版本: JS : .reduce() Method