Calculates the minimum and maximum value of the two given values.

Type signature

([a, b]: [number, number]) => [number, number]

Examples

minMax([5, 3]);
// ⇒ [3, 5]
Try in REPL
minMax([3, 5]);
// ⇒ [3, 5]
Try in REPL

Questions

  • How to get ordered values where the lower is the first and the higher is the second?

TypeScript sourceJavaScript source