-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTeam_Stats.js
More file actions
78 lines (71 loc) · 1.35 KB
/
Team_Stats.js
File metadata and controls
78 lines (71 loc) · 1.35 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
const team = {
_games: [
{
opponentName: 'Everton',
teamScore: 2,
opponentScore: 2,
},
{
opponentName: 'Chelsea',
teamScore: 1,
opponentScore: 0,
},
{
opponentName: 'Wolves',
teamScore: 1,
opponentScore: 1,
},
],
_players: [
{
firstName: 'Miguel',
lastName: 'Almirón',
age: 25,
},
{
firstName: 'Yoshinori',
lastName: 'Muto',
age: 27,
},
{
firstName: 'Sean',
lastName: 'Longstaff',
age: 22,
},
{
firstName: 'Andrew',
lastName: 'Carroll',
age: 31,
},
],
get games() {
return this._games;
},
get players() {
return this._players;
},
addPlayer(firstName, lastName, age) {
let player = {
firstName: firstName,
lastName: lastName,
age: age,
};
this.players.push(player);
},
addGame(opponentName, teamScore, OpponentScore) {
let game = {
OpponentName: opponentName,
teamScore: teamScore,
OpponentScore: OpponentScore,
};
this.games.push(game);
}
};
team.addPlayer('Steph', 'Curry', 28);
team.addPlayer('Lisa', 'Leslie', 44);
team.addPlayer('Bugs', 'Bunny', 76);
console.log(team.players);
team.addGame('Man United', 1, 4);
team.addGame('Leicester City', 0, 3);
team.addGame('Everton', 1 , 2);
console.log(team.games);