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