ordering array javascript code example
Example 1: javascript sort
homes.sort(function(a, b) {
return parseFloat(a.price) - parseFloat(b.price);
});
Example 2: javascript sort
homes.sort((a, b) => parseFloat(a.price) - parseFloat(b.price));
homes.sort(function(a, b) {
return parseFloat(a.price) - parseFloat(b.price);
});
homes.sort((a, b) => parseFloat(a.price) - parseFloat(b.price));