-
Notifications
You must be signed in to change notification settings - Fork 0
reduce
Subhajit Sahu edited this page Dec 22, 2022
·
14 revisions
Reduce values of ientries to a single value.
function reduce(x, fr, acc?)
// x: ientries
// fr: reduce function (acc, v, k, x)
// acc: initial value
const ientries = require('extra-ientries');
var x = [["a", 1], ["b", 2], ["c", 3], ["d", 4]];
ientries.reduce(x, (acc, v) => acc+v);
// → 10
ientries.reduce(x, (acc, v) => acc+v, 100);
// → 110