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

156
Vistas
Why is my array coming up as undefined when I try to access the individual elements?

I'm trying to load two user-defined csv files and programmatically compare them (essentially trying to find errors in the files and report those errors to the user). I'm uploading the first and am running into a problem. When I display the entire array console.log(results); it shows me the entire array in the console. However if I try to get the first row console.log(results[0]); I simply see 'undefined' in the console. I also have the same issue when I call console.log(deviceData); in a later snippet of code (works for the entire array but the second I try to access an element I get an undefined). What am I doing wrong?

<script>
    var deviceData = new Array();
    const uploadConfirm = document.getElementById('uploadConfirm').addEventListener('click', () => {
        Papa.parse(document.getElementById('deviceFile').files[0],
        {
            download: true,
            header: false,
            skipEmptyLines: true,
            complete: function(results){
                console.log(results[0]);
                deviceData = results;
            }
        });
    });
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