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

76
Vistas
Reading data from object in javascript

I want to transfer the images selected by the user to an object with javascript and read from there. I do this using the code below. When I print the productImages variable to the console, the data appears, but what should I do to read the data one by one?


let productImages = {};
var totalfiles = document.getElementById('uploadImages').files.length;
let x = 0;
for (var index = 0; index < totalfiles; index++) {
    var file = document.getElementById('uploadImages').files[index];
    if (file) {
        var reader = new FileReader();
        reader.readAsDataURL(file);
        reader.onload = async function(e) {
            Image = e.target.result;
            productImages[x] = {'data': {'image': Image}};
            x++;
        };
    }
}
about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Try this way, to ready your productImages object

for (const image in productImages) {
  console.log(productImages[image].data);
}
about 4 years ago · Santiago Trujillo 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