How to run a setInterval that loops and tries a max of 10 times before breaking?
<p>I have the following to try to reload on a connection drop:</p>

<pre><code>setInterval(window.location.reload(), 1000);
</code></pre>

<p>My concern with this is that it could continue forever, ddos'ing my application.</p>

<p>How can I update the above to try at max 20 times before giving up and breaking?</p>

<p>Thank you</p>
