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

100
Vistas
how to convert object to list in javascript

Here is my Input Could you all help me out to get the all object based on values as list

{
    Jack: 2,
    olive: 1,
    harry: 2
}

Want my output to be

harry = 2          
olive = 1
jack  = 2

Let me know if there is a way to get the output as mentioned above in javascript

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

0

You can use the function Object.entries(object) and loop over all the entries to log the information how you want.

For more information on Object.entries(object) visit https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries

const data = {
  Jack: 2,
  olive: 1,
  harry: 2
};

const entries = Object.entries(data);

entries.forEach(([key, value]) => console.log(`${key} = ${value}`));
about 4 years ago · Juan Pablo Isaza Denunciar

0

You could try the following:

const result = Object.entries(theObject).map(([key, value]) => `${key.toLowerCase((} = ${value}`).join(‘\n’);
console.log(result);

Hopefully that helps!

about 4 years ago · Juan Pablo Isaza Denunciar

0

Please check Object.entries() or Object.keys().

Object.entries():- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries

Object.keys():- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys

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