title: Adding the total cost of a shopping cart
body: <p>Hi I am trying to add up the total price each time a new item is added to the cart. I know the code can be written cleaner and more complex but I have been asked to use this format. With my current code the total stays at 0. My buttons are working fine.</p>
  
  <pre><code>var price = 0;
  var totalPrice = 0;
  
  var cartSummary = "";
  
  price = product1.price;
  cartSummary += product1.name + " €" + product1.price + "&lt;br&gt;";
  totalPrice += product1.price;
  document.getElementById("cart").innerHTML = cartSummary;
  </code></pre>