I’m trying to solve a simple problem here but I have no idea what direction to take. getAuthNumber() // returns a promise with a number (eg 98765) // response times can be 5s-20s <div class=“auth”> </div> //code let counter = 0; let el = document.getElementsbyClassName(“auth”)[0]; let func = setInterval(function(){ counter++; getAuthNumber().then((num)=>{ return [num, counter]; }).then(res){ If(counter == res[1]) el.innerHTML = res[0]; }, 10000); I need to write a function that gets the auth number every 10s & displays it in the block below. I’ve tried using set interval but getAuthNumber() can take more than 10s to return in which case, I need to discard that response and only show the current value. Continue reading...