Sort List
Examples in
JavaScript
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.sort();
console.log(fruits);
fruits.reverse(); // Then reverse the order of the elements
console.log(fruits);
// Custom sort
var complexList = [{prop: 1}, {prop:100}, {prop:23}];
complexList.sort(function(a, b){return a.prop - b.prop});
console.log(complexList);