Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

192
Vistas
How to get key value in this case {Java Script}

Hi so what iam trying to achieve is basically is simple.Iam try to get only the object key's value from the given array so this is my example array

[{'aaa': '11','text':'hello'},{'aaa': '12','text':'bye'}] iam expecting a output of something like this [11,12]

where iam getting the data of the aaa key only

about 4 years ago · Juan Pablo Isaza
3 Respuestas
Responde la pregunta

0

This will do what you want, but the order could well change between different javascript implementations

const input = [{'aaa': '11','text':'hello'},{'bbb': '12','text':'bye'}]

const output = input.map(x => Object.values(x)[0]);

console.log(output)


I note you updated the quesrtion to have both the same first key - if you're looking for aaa value from all elements this is much simpler

const input = [{'aaa': '11','text':'hello'},{'aaa': '12','text':'bye'}]

const output = input.map(x => x.aaa);

console.log(output)

about 4 years ago · Juan Pablo Isaza Denunciar

0

const o = [{'aaa': '11','text':'hello'},{'aaa': '12','text':'bye'}]

const filtered = o.map(i => +i.aaa)
console.log(filtered)

about 4 years ago · Juan Pablo Isaza Denunciar

0

The JSON path if you convert this into a JavaScript Object Notation format (as JSON).

0.aaa = 11

1.bbb = 12

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda