Created
November 24, 2021 00:41
-
-
Save koraduba7/22fd0240c0df6bb7ca88be5b72e066c1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const team = { | |
_players: [ | |
{ | |
firstName: 'Danila', | |
lastName: 'Slabovat', | |
age: 19 | |
}, | |
{ | |
firstName: 'Mark', | |
lastName: 'GameMaster', | |
age: 18 | |
}, | |
{ | |
firstName: 'Arseniy', | |
lastName: 'Programátor', | |
age: 18 | |
}, | |
], | |
_games: [ | |
{ | |
opponent: 'Dota', | |
teamPoints: 44, | |
opponentPoints: 9000 | |
}, | |
{ | |
opponent: 'programming', | |
teamPoints: 25, | |
opponentPoints: 1011 | |
}, | |
{ | |
opponent: 'chesky language', | |
teamPoints: 39, | |
opponentPoints: 100 | |
} | |
], | |
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 (opponentTeamName, points, opponentPoints){ | |
let game = { | |
opponent: opponentTeamName, | |
teamPoints: points, | |
opponentPoints: opponentPoints | |
}; | |
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('Fnatic', 6, 56); | |
team.addGame('NaVi', 10, 43); | |
team.addGame('Poseurs', 55, 3); | |
console.log(team._games); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment