var i = 0;
var timer;
var start = function(){
console.log("start");
timer = setInterval( function(){
console.log( i++ )}, 1000)
} ;
var clear= function () {
console.log("clear");
clearInterval(timer);
//setTimeout(start,2000) //重启
}
setTimeout(clear,5000) start();
网友评论