This method is like reduce except that it iterates over elements of collection from right to left.
reduce
collection
The collection to iterate over.
The function invoked per iteration.
Returns the accumulated value.
0.1.0
const array = [[0, 1], [2, 3], [4, 5]]reduceRight(array, (flattened, other) => flattened.concat(other), [])// => [4, 5, 2, 3, 0, 1] Copy
const array = [[0, 1], [2, 3], [4, 5]]reduceRight(array, (flattened, other) => flattened.concat(other), [])// => [4, 5, 2, 3, 0, 1]
This method is like
reduceexcept that it iterates over elements ofcollectionfrom right to left.