console.log('main-1')function foo(param){ var p = new Promise(function(resolve, reject) { console.log('promise-1') if (param === 1) {
resolve('1')
} else {
reject('2')
} console.log('promise-2')
}) return p
}console.log('main-2')
foo(1).then(function(value) { console.log('then-1')
})console.log('main-3')
添加回答
举报
0/150
提交
取消