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

149
Vistas
get specific element in array of objects javascript

Given that I have

const countArray = [{count: 97}, {count: 100}, {count: 101}, {count: 102}, {count: 99}, {count: 101}];

What could I do to get 97 for example?

here's what Ive tried

console.log(Object.values(countArray[0]));

this outputs Array [97], but im trying to get just 97.

any help would be appreciated

Note: Ive already looked at similar Stack Overflow posts

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

0

Object.values() always returns array. Reference - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_objects/Object/values

so you can try this console.log(Object.values(countArray[0])[0]);

and if the key will be same for all the objects then you can try console.log(countArray[0]['count'] );

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