Skip to content

Latest commit

 

History

History
25 lines (20 loc) · 415 Bytes

promise-1.md

File metadata and controls

25 lines (20 loc) · 415 Bytes

代码块(阿里二面)

请回答打印的结果是多少?

var p1=new Promise(resolve => {
    console.log(1)
    resolve(2)
})
var p2=new Promise(resolve => {
    console.log(3)
    resolve(p1)
})
p1.then(re => {
    console.log(re)    
})
p2.then(re => {
    console.log(re)
})

参考资料:

题目来源