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}