Skip to content
Subhajit Sahu edited this page Feb 4, 2021 · 14 revisions

Reduces values to a single value. 📦 😺 🏃 📼 🌔 📜 📰 📘

Similar: map, reduce, filter, filterAt, reject, rejectAt.


entries.reduce(x, fr, [acc]);
// x:   entries
// fr:  reduce function (acc, v, k, x)
// acc: initial value
const entries = require("extra-entries");

var x = [["a", 1], ["b", 2], ["c", 3], ["d", 4]];
entries.reduce(x, (acc, v) => acc+v);
// 10

entries.reduce(x, (acc, v) => acc+v, 100);
// 110


References

Clone this wiki locally