If you have an array of objects that you need to sort into a certain order, the temptation might be to reach for a JavaScript library. Before you do however, rember that you can do some pretty neat sorting with the native Array.sort function….
Source: https://www.sitepoint.com/sort-an-array-of-objects-in-javascript/