var sleep = function(){ return new Promise(function(res,rej){ setTimeout(()=>{ res('sleep.....'); },3000); }) }; var delay = function(){ return new Promise(function(res,rej){ setTimeout(function(){ //调用res函数返回数据 res('delay.....'); },1000); }) }; var run = async function(){ /** * 首先执行slepp函数等待sleep执行结束之后,才能继续执行delay函数 */ let result = await sleep(); console.log(result); let delaySource = await delay(); console.log(delaySource); }; run();