title: is it possible to await for a promise response using setInterval?
body: <p>Basically i have an timer, lets say the timer starts at 60 seconds and goes to 0 when it reaches 0 it makes an api call and the timer restarts, the issue im having is that when the timer reaches 0 it just restars without awaiting for the promise response, in someway i need for the timer to pause at 0 wait for the response and then start counting from 60 again, i tried using <code>clearInterval()</code> but it works only in the 1st countdown after it the timer just stops, here is my following code, i think it will be easier to understand</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>setInterval(async () =&gt; {
      document.querySelector('.timeh1').innerHTML = newInterval - i
      i++
      if(i &gt;= newInterval){
          await apiCallReload(currency)                
          i = 0
      }
      }, 1000)</code></pre>
  </div>
  </div>
  </p>
  <p>as you can see this function is executed each second and when the running time (i) reaches the timer limit (newInterval) it will call my <code>apiCallReload()</code> function and the timer will reset to 0 again, but the problem is that the timer resets without awaiting for the function promise ( it takes between 5 - 10 seconds to get the response from the api) is there an way/workaround that i can make the timer stops when it reaches 0, wait for the api response and then start counting again?</p>