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

255
Visualizações
How to get a value from an Array of object without calling the key (i've searched through the internet can't found the exact/similar problem to this)

So i had this kind of const value

    const testingObjArr = [
    {
      asdasdasdasdds:"testing 123"
    },
    {
      bcdefghasdkl:"testing 456"
    },
    {
      asdklqwoepskalx:"testing 678"
    },
 ]

I want to getting the value only and push that into a new array like this

["testing 123", "testing 456", "testing 678"]

I've tried using Object.values and similar ways but always return the same values when log it.

this is the last method that i used

console.log( "testing objs",Object.values(obj).map(i => i).flat())

I also use this loop to getting the values

const testingObjArrLength = Object.keys(testingObjArr).length;
const finalDatas = [];
for(let x=0; x<testingObjArrLength; x++) {
  const datas = Object.values(testingObjArr)[x]
  finalDatas.push(datas);
}
console.log("finaldatas", finalDatas);

This is the results in console log

enter image description here

can anyone give me an advice? appreciate that if not tagged this with duplicate, because i've been around searching for the solutions

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

0

You could take Array#flatMap with Object.values as callback.

const
    data = [{ asdasdasdasdds: "testing 123" }, { bcdefghasdkl: "testing 456" }, { asdklqwoepskalx: "testing 678" }],
    values = data.flatMap(Object.values);

console.log(values);

about 4 years ago · Santiago Gelvez 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