Easy
This question is a daily question and will count towards your daily streak.
You have a shopping cart with multiple items, each represented as an object in an array. Which method allows you to calculate the total cost of all items in the cart efficiently?
1const cart = [2 { name: "Laptop", price: 1200 },3 { name: "Mouse", price: 25 },4 { name: "Keyboard", price: 50 },5 { name: "Monitor", price: 200 },6];78// Calculate the total price of items in the cart9const totalPrice = cart.________(item => item.price);10console.log(totalPrice);