The collection sort command sorts the items in the collection and uses the comparator property to sort the items.
options − It contains optional parameters such as true or false to disable or enable the sorting.
Let us carry out the following steps to see how the above code works −
Save the above code in the sort.htm file
Open this HTML file in a browser.