Example 1 — Official Min / Max Range
Run Math.min and Math.max on the same numbers; collect both results.
const getRange = R.juxt([Math.min, Math.max]);
console.log(getRange(3, 4, 9, -3));
// → [-3, 9] How It Works
- List the fns. First
Math.min, thenMath.max. - Same args. Both see
3, 4, 9, -3in one call. - Results. Min is
-3, max is9. - Array out. Juxt returns
[-3, 9]in function order.
