-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathteamStats.js
More file actions
62 lines (55 loc) · 1.1 KB
/
teamStats.js
File metadata and controls
62 lines (55 loc) · 1.1 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
// Practice objects with get() to change the values of the properties
const team = {
_players :[
{firstName: 'Pablo',
lastName:'Sanchez',
age: 11},
{firstName: 'Jose',
lastName:'Ramirez',
age: 11},
{firstName: 'Pedro',
lastName:'Ruiz',
age: 11} ],
_games : [
{opponent:'Broncos',
teamPoints: 42,
opponentPoints:27
},
{opponent:'estrellitas',
teamPoints: 100,
opponentPoints:99
},
{opponent:'lunas',
teamPoints: 98,
opponentPoints:1
}
],
get players (){
return this._players;
},
get games (){
return this._games;
},
addPlayer (firstName, lastName, age){
let player ={
firstName:firstName,
lastName:lastName,
age:age
};
this.players.push(player);
},
addGame(opponent,teamPoints,oppPoints){
let game ={
opponent:opponent,
teamPoints: teamPoints,
opponentPoints:oppPoints
};
this.games.push(game)
},
};
team.addPlayer('Steph','Curry', 28);
team.addPlayer('Lisa','Leslie', 44);
team.addPlayer('Bugs','Bunny', 76)
team.addGame('poker',3, 1)
console.log(team._players)
console.log(team._games)