new Promise((resolve, reject) => {
let data = 'hello word'
if (data.length < 2) {
setTimeout(() => {
console.log('1')
resolve()
}, 300)
} else {
reject(data)
}
})
.then(() => { console.log('2') }, () => { console.log('3') })
网友评论