When should this come to mind?
Reorder values by a chosen key so local comparisons reveal global structure, such as neighboring overlapping ranges.
Ordered groupsSweep by start timeAdjacent duplicate checks
What makes it work
JavaScript's default sort is lexicographic; use a numeric comparator. Copy the input if mutation is not intended. Insertion Sort explicitly modifies its input.
When to choose something else
Sorting changes positional information unless original indices are retained. It may cost more than a single-pass hash solution.