Reduce a cart
Take your time, follow the code and check your understanding.
The codeFunctions
const prices = [5, 10, 15];
console.log(prices.reduce((total, price) => total + price, 0));Your answer3 min · no timer
Show solution and explanation
The accumulator starts at zero and adds all three prices.
30