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

115
Visualizações
How to destructure an array/object

I want to destructure this but i can't get it (I need the vcardArray)

I can't get it with .vcardArray or with const { vcardArray } = *variablename

[
    { 
        objectClassName: 'entity', 
        handle: '292', 
        roles: ['registrar'], 
        publicIds: [[Object]], 
        vcardArray: ['vcard', [Array]], 
        entities: [[Object]]
    }
]
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Destructuring syntax is exactly the same as object and array literal syntax,¹ it's just interpreted the other way around (and it's more common for us to use the shorthand {name} form than the full {name: name} form, though both are used).

So if you think about how you'd create an array with an object with a vcardArray property, that's how you destructure it.

const [ { vcardArray } ] = /*...your object...*/;

¹ With one caveat: The innermost tokens have to be assignable targets, so they can't be literals. {example: 42} is a valid object literal (creating an object with an example property and setting that property to 42), but you can't use it as a destructuring pattern because it would mean "get the example property and assign it to 42" you can't assign to the literal 42.

about 4 years ago · Juan Pablo Isaza 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