Finds largest entry.
npm install @extra-array/max.minFinds largest entry.
:package:
:smiley_cat:
:running:
:vhs:
:moon:
:scroll:
:newspaper:
:blue_book:
> Similar: [min], [max], [range].
> This is part of package [extra-array].
[extra-array]: https://www.npmjs.com/package/extra-array
> This is browserified, minified version of [@extra-array/max].
> It is exported as global variable array_max.
> CDN: [unpkg], [jsDelivr].
[@extra-array/max]: https://www.npmjs.com/package/@extra-array/max
[unpkg]: https://unpkg.com/@extra-array/max.min
[jsDelivr]: https://cdn.jsdelivr.net/npm/@extra-array/max.min
``javascript`
array.max(x, [fc], [fm]);
// x: an array
// fc: compare function (a, b)
// fm: map function (v, i, x)
// → [index, value]
`javascript
const array = require("extra-array");
var x = [1, 2, -3, -4];
array.max(x);
// [ 1, 2 ]
array.max(x, (a, b) => Math.abs(a) - Math.abs(b));
// [ 3, -4 ]
array.max(x, null, v => Math.abs(v));
// [ 3, -4 ]
``
- Math.max: MDN web docs
- Array.max: sugarjs
[max]: https://github.com/nodef/extra-array/wiki/max
[min]: https://github.com/nodef/extra-array/wiki/min
[range]: https://github.com/nodef/extra-array/wiki/range