-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathteamStats.js
More file actions
64 lines (62 loc) · 1.09 KB
/
teamStats.js
File metadata and controls
64 lines (62 loc) · 1.09 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
const team = {
_players : [
{
firstName: 'Sarvesh',
lastname: 'Dubey',
age: 20
},
{
firstName: 'Devesh',
lastname: 'Dubey',
age: 25
},
{
firstName: 'Raghav',
lastname: 'Dubey',
age: 20
}
],
_games : [
{
opponent: 'Broncos',
teamPoints: 42,
opponentPoints: 27
},
{
opponent: 'Chess',
teamPoints: 12,
opponentPoints: 27
},
{
opponent: 'Football',
teamPoints: 5,
opponentPoints: 2
}
],
get players() {
return this._players
},
get games() {
return this._games
},
addPlayer(firstName, lastName, age){
this._players.push({
firstName: firstName,
lastName: lastName,
age: age
})
},
addGame(oppenent,teamPoints,oppenentPoints){
this._games.push(
{
opponenet: opponent,
teamPoints: teamPoints,
opponentPoints: opponentPoints
}
)
}
}
team.addPlayer('Steph','Curry','28')
team.addPlayer('Lisa','Leslie','44')
team.addPlayer('Bugs','Bunny','76')
console.log(team.players)