I have array, lets call it fruit_shop, which contains a bunch of fruits. The fruits are objects with 3 params, name, unit_price, stock; which stands for the name of the fruit, stock in the shop and current price per unit. I need to find out which fruit has the maximum/minimum stock and which has the maximum value[unit_price*stock].
fruit_shop = [
{ name: "Apple",unit_price: 100, stock:5 },
{ name: "Mango",unit_price: 120, stock:4 },
{ name: "Orange",unit_price: 90, stock:6 }];
P.S. I am using javascript.
forloop.