Since you named a local variable called tt, which does not allow you to access the global variable tt. Very poor variable name planning.
Your code will also not stop after 10 seconds, it will stop when the time is 10 seconds or 10 minutes.
function checkTime(xtt) { if (xtt==10) { xtt="0" + xtt; console.log(xtt); clearInterval(tt); } return xtt; }
source share