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

84
Visualizações
My console log is reading undefined even tough the value has been set in data

I'm making a pollingapp in which I wanted to implement unique nicknames so in the <script> part. I have this data function which contains some parameter which I have been having no trouble calling except for one I have this leaderboard object which is simply: leaderBoard:{nicknames:[], scores:[]},

I have then in the created part made a

socket.on("nickNames", function(nicknames){
  this.leaderBoard.nicknames = nicknames;
}

Or well that's the gist of it my console is then telling me that

"Uncaught TypeError: Cannot set properties of undefined (setting 'nicknames')"

And I have no idea how to fix it and I have checked that nicknames is defined and everything seems to be working okay except for this.

EDIT: apparently when using a function like above this is not actually refering to the data objects the soloutin was to instead use something called a gamma function? which instead of function(nicknames){code} should look like (nicknames) =>{code}

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