/array/sort
stdSorts the given array without mutating it.
Type signature
(
f?: (a: any, b: any) => number
) => (xs: any[]) => any[]
Examples
sort((a, b) => a - b)([
13,
79,
20,
69,
44,
67,
18,
95,
26,
55,
]);
// ⇒ [13, 18, 20, 26, 44, 55, 67, 69, 79, 95]
Try in REPL
Questions
- How to sort an array without mutating it?