Pergunta de entrevista da empresa HyperGuest

Please write more efficient implementation of the next function: const someFunc = async ()=>{ const a = await somePromise(); const b = await someOtherPromise(); return [a,b]; }

Resposta da entrevista

Sigiloso

18 de mar. de 2024

I answered a wrong answer .... I wasn't thinking about simply using Promise.all() const someFunc = () => { return somePromise().then(a => { return someOtherPromise().then(b => { return [a, b]; }); }); };