The method .push are undefined in object

hello, the push method of arrays is undefined when I try to declare it in the function of an object.

here is the code link:

and the error message on the console

Hi Gregory,

welcome to the forums!
It’s not the method that is undefined but the object/array you’re trying to apply it to: ‘this.players’ doesn’t exist.

Hello and thank you for the welcome!

Indeed I just saw that, I had a typo on the declaration of my object.
thank you for the help

1 Like