我有这样的代码:
var a = 5;
var i = setInterval(timer, 1000);
function timer() {
if (a < 1) {
console.log('Reaching Stop');
clearInterval(i);
var endInterval="ok";
}
a -= 1;
}
console.log(endInterval);
问题是:
如何从endInterval
输出setInterval
?