Skip to content
Snippets Groups Projects

Resolve "Create function to divide users in lobbies"

3 files
+ 201
27
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 0
20
//Create a lobby class that contains a id, price, and a list of users(lobby members)
class Lobby {
constructor(id, price) {
this.id = id;
this.price = price;
this.users = [];
}
addUser(user) {
this.users.push(user);
}
removeUser(user) {
this.users.splice(this.users.indexOf(user), 1);
}
getLobbyMembers() {
return this.users;
}
}
\ No newline at end of file
Loading