Guia de entrevista · JavaScript

What are the differences between Promise combinators?

do caderno de estudos · atualizado em 2 de outubro de 2026
Para quem vai encarar entrevista de JavaScript2 min

Não decore palavra por palavra: entenda a estrutura da resposta e refaça com as suas palavras, em inglês.

A resposta, como você fala na entrevista

Promise.all: fulfills with results in input order when all fulfill. Rejects when an input rejection is observed.
Promise.allSettled: fulfills with each input's outcome in input order after all settle. An input rejection becomes a rejected status rather than rejecting the aggregate. An invalid or throwing iterable can still reject the aggregate.
Promise.race: adopts the first observed settlement, fulfillment or rejection.
Promise.any: fulfills with the first observed fulfillment. If every input rejects, it rejects with AggregateError containing reasons in input order.

Trap: none of these cancels the other operations. Cancellation needs separate support, such as an AbortSignal. For empty arrays, all and allSettled fulfill with [], any rejects with AggregateError, and race stays pending.

Pegadinha clássica

Essa pergunta tem uma armadilha que derruba muita gente em entrevista. Ela está marcada na resposta acima: vale reler antes de treinar.

Ler é o primeiro passo. No app, essa pergunta vira flashcard com repetição espaçada, e o módulo tem quiz e simulado para testar o que ficou.

Treinar essa pergunta no app