- Array is sorted in place, and sorted array is returned.
- Default sort is in ascending order by converting each element to string.
- Custom sort order can be specified using a callback function
compareFunction(a, b)
- When function returns < 0,
a
appears beforeb
in sorted array. - When function return 0,
a
andb
remain unchanged with respect to each other. - When function returns > 0,
b
appears beforea
in sorted array.
- When function returns < 0,