function myTimeout(ms,name){ return new Promise( (resolve,reject) => void setTimeout(resolve,ms,'hello ' + name) ); } //then的链式调用 myTimeout(1000,'Diana').then( (receive) => { console.log(receive); return myTimeout(2000,'Yasuo'); }).then( receive => { console.log(receive); return myTimeout(1000,'Kathrine'); }).then( receive => void console.log(receive) ) console.log('执行!'); //会先于promise 执行