Reduces values from right, to a single value.
npm install @extra-array/reduce-rightReduces 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].
[extra-array]: https://www.npmjs.com/package/extra-array
``javascript`
array.reduceRight(x, fr, [acc]);
// x: an array
// fr: reduce function (acc, v, i, x)
// acc: initial value
`javascript
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
``
- Data.List.reduce: Haskell
- Array.prototype.reduce: MDN web docs
- iterable_reduce: PHP
- Array.reduceRight: sugarjs
[reduce]: https://github.com/nodef/extra-array/wiki/reduce
[reduceRight]: https://github.com/nodef/extra-array/wiki/reduceRight
[map]: https://github.com/nodef/extra-array/wiki/map
[filter]: https://github.com/nodef/extra-array/wiki/filter
[accumulate]: https://github.com/nodef/extra-array/wiki/accumulate
[reject]: https://github.com/nodef/extra-array/wiki/reject