#Push in array doesn't work?

10 messages · Page 1 of 1 (latest)

wanton wave

Hi!
An idea?

client.lastPseudo = []
client.lastPseudo.push([player[0], new Date().getTime()]);

ERR:
TypeError: client.lastPseudo.push is not a function
    at Timeout._onTimeout (/home/main.js:213:47)
    at listOnTimeout (node:internal/timers:569:17)
    at process.processTimers (node:internal/timers:512:7)
drowsy fulcrumBOT
  • Consider reading #how-to-get-help to improve your question!
  • Explain what exactly your issue is.
  • Post the full error stack trace, not just the top part!
  • Show your code!
  • Issue solved? Press the button!
wary anvil

Are those two lines immediately after each other like you showed here? Or is the actual code a little more complex?

Then probably client.lastPseudo isn’t what you think it is in the other file. Console.log it there to find out

console.log(typeof client.lastPseudo) then

wanton wave
client.position = "aa"; //WORKS
client.lastPseudo = [];    //DOESN'T WORK
wanton wave
wary anvil
wary anvil
wanton wave

How so?