classTest{constructor(){constnums=[1,2,3];(async()=>{for(letiofnums){letx=awaitthis.print(i);console.log(x);}})();}print(x){returnnewPromise((resolve,reject)=>{setTimeout(()=>{resolve(x);},1000);})}}consttest=newTest();(async()=>{letx4=awaittest.print(4);console.log(x4);letx5=awaittest.print(5);console.log(x5);})();怎样才能做到顺序输出12345?
互换的青春
蝴蝶刀刀
相关分类