HyperGuest interview question

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

Interview Answer

Anonymous

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