Skip to content

minimum

Subhajit Sahu edited this page May 3, 2023 · 1 revision

Find first smallest value.

Alternatives: minimum, minimumEntry.
Similar: minimum, maximum, range.


function minimum(x, fc, fm)
// x:  an array
// fc: compare function (a, b)
// fm: map function (v, i, x)
const xarray = require('extra-array');

var x = [1, 2, -3, -4];
xarray.min(x);
// → -4

xarray.min(x, (a, b) => Math.abs(a) - Math.abs(b));
// → 0

xarray.min(x, null, v => Math.abs(v));
// → 0


References

Clone this wiki locally