title: How setInterval runs asynchronously
body: <p>I have a setInterval function that runs async code that calls the server:</p>
  
  <pre><code>setInterval(()=&gt; {
      //run AJAX function here
  }, 5000);
  </code></pre>
  
  <p>If the server doesn't get a response within 5 seconds most probably it will run set Interval again which will then make multiple requests on the same endpoint, is there a way that the setInterval only starts its next 5 second execution after the AJAX function returns a response?</p>