Is there another way to find the total sum in an object, What if we had a bunch of properties ? How would you approach this…?
cartForParty = {coldrinks:10,beers:10,chips:5,ballons:10,cakes:10};
function calcTotalPrice(cartForParty){
var sum = cartForParty.coldrinks + cartForParty.beers + cartForParty.chips + cartForParty.ballons + cartForParty.cakes;
return `Your total cart is $${sum}`;
}
console.log(calcTotalPrice(cartForParty));