reduceRight() 方法的功能和 reduce() 功能是一样的,不同的是 reduceRight() 从数组的末尾向前将数组中的数组项做累加。

const list = [1, 2, 3, 4, 5];
list.reduceRight((total, item) => total + item, 0); // 15