Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

166
Visualizações
How to transcribe this nullish coalescing operator with added equal mark to regular ternary operator

How would this shortcut nullish operator be in the plain ternary operator syntax

obj = obj[array[i]] ??= {}

What is confusing for me here is the added = after the two ??

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

The logical nullish assignment (x ??= y) operator only assigns if x is nullish (null or undefined).

in your question,

if obj[array[i]] equals to null or undefined, then obj[array[i]] will be {}.

checkout the mdn documentation:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_nullish_assignment

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda