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

217
Visualizações
Using a for loop in JavaScript to loop over an array of objects

My code and terminal

Just ignore the comments, they are in danish as it is for a school assignment.. I need some help. My loop keeps giving me an undefined value in my terminal, and I can't seem to find the issue. It is working as it should, and gives me the correct values, but still has those 'undefined' ones which irritates me.

EDIT: Has been fixed by @aqq, thx for the help everybody!

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

As @dikuw mentioned the undefined call might be coming from the gørBeskedPersonlig function being called.

I don't see that function being defined in your code so that's probably it, try commenting out the following line:

console.log(gørBeskedPersonlig(katalog[index].navn)); 

UPDATE: After reviewing your code, i can see that the function gørBeskedPersonlig was not returning anything.

Updating it to return the new value has fixed the "undefined" error.

function gørBeskedPersonlig(navn){
    hemmeligBesked.splice(1,1,navn+'!');
    return hemmeligBesked.join(' ');
}
about 4 years ago · Juan Pablo Isaza Relatório

0

It seems that you have some console.log() in function gørBeskedPersonlig that is returning undefined. Send a code for that function.

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