Skip to content
RED SAG Skills
hardStudy question · answer published in JavaScript interview questions, so no pointsjavascriptreliability

One failure in Promise.all

You fan out three LLM calls in Node.js. What does this code log?

async function call(id) {
  if (id === 2) throw new Error('rate limited')
  return id * 10
}
const out = []
try {
  const r = await Promise.all([1, 2, 3].map(call))
  out.push(...r)
} catch (e) {
  out.push(e.message)
}
console.log(out)
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions