node sort code example
Example 1: javascript sort
homes.sort(function(a, b) {
return parseFloat(a.price) - parseFloat(b.price);
});
Example 2: sort function explained javascript
var sortedArray = myArray.sort(function(a,b){
if (a.name < b.name)
return -1;
else if (a.name == b.name)
return 0;
else
return 1;
});