In brief
The method is appropriate when the original arrangement is still needed.
Useful to know
toSorted() returns a new sorted array instead of rearranging the original one. For example, [12, 3, 8].toSorted((a, b) => a - b) gives [3, 8, 12]. The numerical comparison function is an essential . [1]
This helps with the "By price" interface, when you need to keep the order of receipt as well. The copy is shallow: an edit of an object property can be seen through both arrays. Check support in the target environment before using the method in an application for older browsers.
Sources
For further detail and to check the information: