codable 2019-07-01
setTimeout(function() { console.log('1s') setTimeout(function() { console.log('2s') }, 1000) }, 1000)Promise 实现
const wait = () => new Promise((resolve, reject) => { setTimeout(resolve, 1000) }) wait().then(() => { console.log('1s') return wait() }) .then(() => console.log('2s'))