是否可以操纵Array.prototype.reduce的索引参数?

Is it possible to manipulate the index parameter of Array.prototype.reduce?

通常Array.prototype.reduce的索引值取值从0到Array.length。 是否可以操纵该值,使其从 Array.length 开始并下降到 0?

不,但你总是可以这样做...

var yourNumber = arr.length - 1 - index;

...或 Array.prototype.reduceRight() 将从最后一个索引循环到第一个(反向)。

您可以随时使用 Array.prototype.reduceRight()