JS 定时器 setInterval() 和 setTimeout() 面试题:定时器传参和返回值,异步任务
题目如下,fn1()和fn2()结果?functionfn1(){for(vari=0;i<4;i++){vartc=setTimeout(function(i){console.log(i);clearTimeout(tc);},10,i)}}functionfn2(){for(vari=0;i<4;i++){vartc=setInterval(function(i,tc){console.lo