3 ms·
const [result1, result3] = await Promise.all([task1(), task2.then(res => task3(res))])
by golergka 6y ago
const [result1, result3] = await Promise.all([task1(), task2.then(res => task3(res))])
- postalrat 6y agoCould that be written const task2then3 = async () => task3(await task2()); const [result1, result3] = await Promise.all([task1(), task2then3()])
- nailer 6y agoI'd just: async function getResult3(){ const res = await task2() return task3(res)) } const [result1, result3] = await Promise.all([task1(), getResult3()])