Backbone.js collection.sort()

In Backbone.js, sort collection method is used to sort the items in the collection. It is used with comparator property in order to sort the items.

Syntax:


Parameter explanation:

options:It specifies two parameters "true" or "false" to enable or disable the sorting.

Let's take an example to deploy sort collection method.

See this example:

Test it Now

Output:

Save the above code in sort.html file and open this file in a new browser.

BackboneJS Sort Collection



Latest Courses