promise难道不是异步的?

111 阅读1分钟

为什么运行的结果是cdab而不是cabd

function a(){console.log("a");}
function b(){console.log("b");}
new Promise(function(resolve,reject){
	console.log("c");
	resolve(22);
}).then(console.log("d"));
a();
b();

// 运行结果
c
d
a
b