sortTimes
The sortTimes() function sorts an array of TheTime according to the desired order (ASC or DSC) and returns a new sorted array.
Interactive example
Syntax
Classic signature
typescript
function sortTimes<
GenericArray extends readonly TheTime[],
>(
array: GenericArray,
type: SortType,
): TheTime[]Curried signature
typescript
function sortTimes<
GenericArray extends readonly TheTime[],
>(
type: SortType,
): (array: GenericArray) => TheTime[]Parameters
array: Array of durations inTheTimeformat.type: Sort order,"ASC"for ascending,"DSC"for descending.
Return value
A new array containing the same durations sorted. The original array remains unchanged.
