Sort a Readonly Array
Easy · Arrays & Tuples
Write sortedCopy(nums: readonly number[]): number[] that returns a new array sorted ascending.
A readonly array has no mutating methods, so nums.sort() is a type error. Copy it first (for example with [...nums]), then sort the copy with a number comparator.
Next: Swap a Tuple