title: Sum number on every click
body: <p>I have a simple problem but I really dont remember how to solve it, maybe my brain is playing with me, however, here is my problem... I have a product price, I'm adding this price to a <code>var total</code>, the problem is that I want to sum the result of my code to the first result stored on total var. For example:</p>
  <blockquote>
  <p>First click: total = 0, price = 32, after click total = 32.</p>
  <p>Second click: total = 32, price = 100, after click total = 132.</p>
  </blockquote>
  <p>How can I do this? This is my example code:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var total = 0;
  var price = 16;
  
  $('#btn').click(function () {
    var qty = $('#qty').val();
    
    var total = qty * price;
    
    alert(total.toFixed(2));
    
   
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  
  
  &lt;button id="btn"&gt;Click&lt;/button&gt;
  
  &lt;input id="qty" placeholder="Type the number of products u want..." /&gt;</code></pre>
  </div>
  </div>
  </p>