-
Notifications
You must be signed in to change notification settings - Fork 0
max
Subhajit Sahu edited this page Dec 22, 2022
·
13 revisions
Find largest value.
function max(x, fc, fm)
// x: ientries
// fc: compare function (a, b)
// fm: map function (v, k, x)
const ientries = require('extra-ientries');
var x = [["a", 1], ["b", 2], ["c", -3], ["d", -4]];
ientries.max(x);
// → 2
ientries.max(x, (a, b) => Math.abs(a) - Math.abs(b));
// → -4
ientries.max(x, null, v => Math.abs(v));
// → -4