function output(i) { let index = i return new Promise((resolve, reject) => { setTimeout(function () { console.log(new Date, index); resolve() }, 1000); }) } let p = Promise.resolve() // for (let i = 0; i < 5; i++) { // p.then(() => { return this.output(i) }).then(()=>{ // return this.output(i) // }) // //this.ouput(i) // } p.then(() => { return this.output(1) }).then(()=>{ return this.output(2) })