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

195
Vistas
How to get list of map values in Javascript?

I have the following object:

var people = [
    {
        "name": "James",
        "work": "Shake Shack"
    },
    {
        "name": "Stanley Hudson",
        "work": "IBM"
    }
]

Is there an easy way built into Javascript to allow me to get a list of values by their key?

For exemple if I want a list like ["Shake Shack", "IBM"], which is all the values in the array associated with the work key, how can I do?

I know how to do this manually with a loop but I'd really like to know if there's some built-in functionality in Javascript that could do this for me.

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

0

Try using Array.prototype.map :

var people = [
    {
        "name": "James",
        "work": "Shake Shack"
    },
    {
        "name": "Stanley Hudson",
        "work": "IBM"
    }
]

console.log(people.map((one) => one.work))

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