@extra-array/reduce-right
v2.10.19
Published
Reduces values from right, to a single value.
Downloads
195
Maintainers
Readme
Reduces values from right, to a single value. :package: :smiley_cat: :running: :vhs: :moon: :scroll: :newspaper: :blue_book:
Alternatives: reduce, reduceRight. Similar: map, filter, reject, reduce, accumulate.
This is part of package extra-array.
array.reduceRight(x, fr, [acc]);
// x: an array
// fr: reduce function (acc, v, i, x)
// acc: initial value
const array = require("extra-array");
var x = [1, 2, 3, 4];
array.reduceRight(x, (acc, v) => acc+v);
// 10
array.reduceRight(x, (acc, v) => acc+v, 100);
// 110