/*promise 、setTimeout(定时器) 、console.log*/
setTimeout(function(){
console.log('setTimeout---');
},0);
var promise = new Promise(function(resolve, reject){
console.log(\'promise---1\');
resolve();
console.log(\'promise---2\');
reject();
console.log(\'promise---3\');
});
console.log(1111);
promise.then(function(){
console.log(\'promise---success\');
}).catch(function(){
console.log(\'promise---fail\');
});
console.log(111555555551);
优先顺序
1、console == new promise 内的代码
2、new promise 下的resolve()或reject()
3、setTimeout
© 2021.勤客保留所有权利. 备案号: 湘ICP备2021013947