run()的执行问题

const a = () => new Promise((resolve,reject)=>{
    setTimeout(()=>resolve({name: 'y'}),1000);
});

const b = () => new Promise((resolve,reject)=>{
    setTimeout(()=>resolve({age: 10}),100);
});

function run(){
    a();
    b();
}
1
2
3
4
5
6
7
8
9
10
11
12
  • run()的执行时间大概是多少?
  • 修改run函数,将运行时间变成两个promise执行时间的总和
  • 修改run函数,将运行时为最长的promise执行时间
  • 修改run函数,将其运行结果可得到a、b promise 值的结合{name: 'y',age: 10}
Last Updated: 2019-9-3 06:33:06