Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

87
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!