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

160
Visualizações
Make objects from an array of objects

I am working with javascript and have encountered a problem. I need to iterate through an array of objects and make an array objects without the [] symbol.

So, when I iterate trough an array of objects --> [{},{},{}...] I want it to return --> {},{},{} --> without [].

Sry for the bad explanation, but I don't know how to express myself correctly, maybe the best would be: Is it possible to store multiple objects outside object or collection?

In my exapmle, I have an array of objects which I want to map to another array of objects:

 Resurs.map((item)=>({
    Cen:item.Cent,
    level:[item.NumList.map((item)=>({
        Kom:item.Number,
        Num:item.Kor
        })),item.SerList.map((item)=>({
        Kom: item.Ser}))
            ]}));

So, I have 2 map methods inside the map method. It will return:

[
Cen:"aaa",
level:[
[ // -> want to get rid of this
{
Kom:"aaa",
Num:"aaa"
},
{
Kom:"bbb",
Num:"bbb"
}
] // -> and this
,
[ //-> and this
{Kom: "aaa"},
{Kom: "bbb"},
] //-> and this
]
]

So, both map functions need to be inside 'level' key, but not as list which has two lists inside, but list with objects.

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