1//ascending order
2arr.sort(function(a, b){return a-b});
3arr.sort((a, b) => a - b);
4//descending order
5arr.sort(function(a, b){return b - a});
6arr.sort((a, b) => b - a);
1 arr.sort((a, b) => (a.nameofKeyFromArray < b.nameofKeyFromArray ? -1 : Number(a.nameofKeyFromArray > b.nameofKeyFromArray)));