I try to define the rank cars from most expensive to least expensive, using javascript, but I don’t know how to make it the rank.
For now, I am still using the data object array.
<script>
var cars = [];
cars.push({"mobil" : "Kijang Inova", "price" : 300});
cars.push({"mobil" : "Nissan", "price" : 180});
cars.push({"mobil" : "Expander", "price" : 200});
console.log(cars);
</script>
So I Hope get output like this:
[{mobil : "Kijang Inova", "price" : 300, rank : 1},
{mobil : "Expander, "price" :200, rank : 2},
{mobil : "Nissan, "price" : 180, rank : 3}]