/array/minMax
stdComputes minimum and maximum values of the given array in a single run.
Type signature
(xs: number[]) => number[]
Examples
minMax([
10,
5,
3,
-5,
-4,
23,
32,
8,
1,
0,
]);
// ⇒ [-5, 32]
Try in REPL
minMax([1]);
// ⇒ [1, 1]
Try in REPL
minMax([]);
// ⇒ [undefined, undefined]
Try in REPL
Questions
- How to find the minimum and maximum values of an array?
- How to get the min/max element of an array?