|
|
|
|
|
by genezeta
1709 days ago
|
|
The final version of sortNumbers is: function sortNumbers(array: Readonly<Array<number>>) {
return [...array].sort((a, b) => a - b)
}
And sort sorts in place and then returns the sorted array[0]. So here the newly created [...array] is sorted and then returned by sort and then by the return at the start of that line.[0] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... |
|