A shopping cart combines all these concepts. It's an array of product objects with methods to add, remove, and calculate totals.
const cart = {
items: [],
addItem(product) {
this.items.push(product);
},
total() {
return this.items.reduce(
(sum, item) => sum + item.price * item.qty, 0
);
}
};