Jumlahkan Array Objek

let cart = [
  {
    name: "JavaScript book",
    price: 4,
  },
  {
    name: "UGG Women's Hazel Ankle Boot",
    price: 79,
  },
  {
    name: "OXO Good Grips 11-Inch Balloon Whisk",
    price: 9,
  },
];

// totalPrice is 92

let totalPrice = cart.reduce(function (accumulator, item) {
  return accumulator + item.price;
}, 0);
Shibu Sarkar