1
Hello I’m with this error when trying to model a class in javascript:
Player.makePlayer(player,1)
       ^
TypeError: Player.makePlayer is not a function
class player:
class Player {
    constructor() {
      this.id = null;
      this.socketId = null;
      this.name = null;
      this.mmr = null;
    }
    makePlayer(player,socketId){
      this.id = player.id
      this.socketId = socketId
      this.name = player.name
      this.mmr = player.mmr
    }
  }
  module.exports = Player;
I have the same problem in my class match:
class Match {
    constructor() {
      this.id = null
      this.players = null
      this.isActive = null;
    }
    addPlayers(players,socketId){
      this.id = uuid.v4().toString();
      this.socketId = socketId;
      this.players = players;
      this.isActive = false
    }
  }
but in my class match I would need an array of match, and I’m not able to figure out how to solve this.
Hello you could help me on the match?
– Gabriel
thanks bro!!
– Gabriel
match? I don’t understand?
– Augusto Vasques
At the end of the question I posted my class match I’m wondering how to make an array ed my class Match
– Gabriel
Now that I’ve seen it, you want an array
– Augusto Vasques
I’ll probably have to have a support class not?
– Gabriel
Edited.
– Augusto Vasques
Thanks bro, you think it’s unnecessary to create a support class match manager to do this or it’s unnecessary?
– Gabriel
It depends on what you want to do. Anything you implement in the code should preferably be easy and useful. If a class manager is useful for development then implement it, but if it has no purpose its implementation is a waste of time.
– Augusto Vasques