Exercise: Sorting a Collection
Explore how to sort a collection of models in Marionette.js by creating and applying comparator functions. This lesson helps you understand sorting logic within collections, enabling you to display data in a customized, organized manner by first and last name sorting.
We'll cover the following...
We'll cover the following...
Sorting a collection with a function
Let’s say we have the following collection:
If you run the code, you’ll see the contacts in the following order: