js 事件循环面试题
js 事件循环面试题
Promise之后的then中的参数result 取决于 之前 Promise.resolve(param)的 param
console.log(1); setTimeout(()=>console.log(2)); new Promise((resolve, reject)=>{ Promise.resolve(3).then((result)=>{ console.log(result); }); resolve(); console.log(4); }).then((result)=>{ console.log(result); }, (error)=>{ console.log(error); }); console.log(5); //1 4 5 3 undefined 2