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

96
Vistas
JS: is there a way to adhere to an order using a Map?

I want to use a map to store some data but I want to preserve the order in which they come from the API array:

let people = [{ name: "jordan", age: 33}, { name: "rich", age: 23} ]; // comes from API

let map = new Map();

for (let x = 0; x < people.length; x++) {
     map.set(person.name, person.age) 
}

I now have a map of those:

// console.log(map) 

// Map(2) {'jordan' => 33, 'rich' => 23}

if I iterate through that map later on using a for of loop, is the order of the Entries guaranteed in that I would be sure the first age would always be 33?

about 4 years ago · Juan Pablo Isaza
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