title: How to write this window.history.go(-historyCount) correct
body: <p>In a piece of code that I am writing, I need the user to go back in its history depending on the number of products there are in a shopping cart.</p>
  
  <p>So I wrote this code:</p>
  
  <pre><code>var productCount = $('.rdsubs-cart-name').length;
  var historyCount = productCount + 1;
  console.log(historyCount);
  $("a.btn-continue").click(function() {
    window.history.go(-historyCount);
  });
  </code></pre>
  
  <p>But as I expected this part is written wrong.
  <code>window.history.go(-historyCount);</code></p>
  
  <p>I don't know the naming so it is really difficult for me to find something about it in Google. So I was hoping one of you could point me in the right direction!</p>
  
  <p>Thanks!</p>
  
  <p><strong>Some More Info:</strong></p>
  
  <p>When there are 4 products in the cart and the user removes 1 product then it reloads the page. So when the user removes all 4 products it has also reloaded the page 4 times. So if the user clicks on continue shopping then it needs to go back into the history 5 pages. Otherwise, there would be an endless loop of reloading the shopping cart.</p>
  
  <p>When I write <code>window.history.go(-5);</code> it works but when I write <code>window.history.go(-historyCount);</code> nothing happens.</p>
  
  <p><strong>The code was actually correctly written!</strong>
  The culprit was my browser. After opening another browser and going to the same page everything worked as expected. I am thankful for everyone helping out!</p>