Array.sort

Function/Meaning

Sort the array.

Type
Arrayclassmethod of
Syntax
sort(order:string, stable:bool=false)
Arguments
order

The sort order is one of the following strings.
The ascending order is sorted from the smallest to the largest, and the descending order is the opposite.
If omitted, it is considered that'+' is specified.

  • "+" : Ascending order (comparison with the usual
  • "-" : descending order
  • "0" : Numerical ascending order (10,2,1 is sorted into 1,2,10)
  • "9" : Numerical descending order
  • "a" : Ascending order by string ("a", "c", "b" are sorted into "a", "b", "c")
  • "z" : Descending by string

You can specify a function instead of the characters in the sort order.
The function has two arguments.
Specify a function that returns true if the first argument should come before the second argument (note that the return value has a different meaning than the function passed to the JavaScript sort method).

stable

Specifies whether to perform stable sorting.
If omitted, false is assumed and an unstable sort is performed.
In stable sorting, the order of array elements with the same order will be the same after sorting.
In the case of unstable sorting, there is no guarantee that the order of array elements with the same order will be the same after sorting.

Return value
None (void)
Explanation

Combines each element of the array with a delimiter and returns the combined string.