-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTeamStats.js
More file actions
37 lines (37 loc) · 1016 Bytes
/
Copy pathTeamStats.js
File metadata and controls
37 lines (37 loc) · 1016 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
const team = {
_players: [
{ firstName: "Steve", lastName: "Pok", age: 23 },
{ firstName: "Roger", lastName: "Bishop", age: 25 },
{ firstName: "Katrina", lastName: "Alvarez", age: 24 },
],
_games: [
{ opponent: "Neznaju", teamPoints: 10, opponentPoints: 15 },
{ opponent: "Vozmozhni", teamPoints: 4, opponentPoints: 1 },
{ opponent: "Aldriges", teamPoints: 6, opponentPoints: 6 },
],
get players() {
return this._players;
},
get games() {
return this._games;
},
addPlayer(newfirstName, newlastName, newage) {
let player = {
firstName: newfirstName,
lastName: newlastName,
age: newage,
};
this.players.push(player);
},
addGame(newOpponent, newTeamPoints, newOpponentPoints) {
let game = {
opponent: newOpponent,
teamPoints: newTeamPoints,
opponentPoints: newOpponentPoints,
};
this.games.push(game);
},
};
team.addPlayer("Bugs", "Bunny", 76);
team.addGame("Titans", 100, 98);
console.log(team.games);