Returns a new sorted array
const source = [3, 2, 1];sort(source) // [1, 2, 3]sort(source)((a, b) => b - a) // [3, 2, 1] Copy
const source = [3, 2, 1];sort(source) // [1, 2, 3]sort(source)((a, b) => b - a) // [3, 2, 1]
Optional
Returns a new sorted array
Example