let timer = null; let loginStatus = 0; timer = setInterval(() => { if (loginStatus > 10) { clearTimeout(timer) console.log(loginStatus); } loginStatus ++; }, 30);