Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

157
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda