-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTeam Stats.js
63 lines (59 loc) · 1.21 KB
/
Team Stats.js
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
const team = {
_players:[{
firstName:"James",
lastName:"Rodriguez",
age: 21
},{
firstName:"Cristiano",
lastName:"Ronaldo",
age: 32
},{
firstName:"Iker",
lastName:"Cassilas",
age: 35
}],
_games: [{
opponent: 'Barcelona',
teamPoints: 42,
opponentPoints: 27
},{
opponent: 'juventus',
teamPoints: 45,
opponentPoints: 32
},{
opponent: 'AC.Milan',
teamPoints: 48,
opponentPoints: 22
}],
get players(){
const playersKeys = this._players;
return playersKeys;
},
get games(){
const gamesKeys = this._games;
return gamesKeys;
},
addPlayer(firstName,lastName,age){
const player = {
firstName: firstName,
lastName: lastName,
age: age,
}
this._players.push(player);
},
addGame(opponent,teamPoints,opponentPoints){
const game = {
opponent: opponent,
teamPoints: teamPoints,
opponentPoints: opponentPoints,
}
},
};
team.addPlayer('Steph','Curry',28);
team.addPlayer('Lisa ','Leslie',44);
team.addPlayer('Bugs ','Bunny',76);
console.log(team.players);
team.addGame('Atletico Madrid',51,28);
team.addGame('PSG',52,44);
team.addGame('Manchester City',55,57);
console.log(team.games);