Pregunta de entrevista de HyperGuest

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

Respuesta de la entrevista

Anónimo

18 mar 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]; }); }); };