sort by field ascending js code example
Example 1: sort arrays according to first array js
itemsArray.sort(function(a, b){
return sortingArr.indexOf(a) - sortingArr.indexOf(b);
});
Example 2: javascript sort
homes.sort((a, b) => parseFloat(a.price) - parseFloat(b.price));