const p = new Promise((res, rej) => { console.log('我是Promise') // 1 res('我是resolve') }) console.log('我是主线程') // 2 p.then(res => console.log('我是then:'+ res)) // 3
结果:
不用说也能看懂了,promise 的构造函数执行本身并不是异步的,但 then 是异步的
标签:异步,console,log,res,promise,构造函数 From: https://www.cnblogs.com/xt112233/p/17018256.html