Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function tseamAccount(strArr) {
- let acc = strArr.shift().split(' ')
- for (let line of strArr) {
- let [command, game] = line.split(' ')
- if (command === 'Install') {
- if (!acc.includes(game)) {
- acc.push(game)
- }
- } else if (command === 'Uninstall') {
- if (acc.includes(game)) {
- let index = acc.indexOf(game);
- acc.splice(index, 1)
- }
- } else if (command === 'Update') {
- if (acc.includes(game)) {
- let index = acc.indexOf(game);
- acc.splice(index, 1)
- acc.push(game)
- }
- } else if (command === 'Expansion') {
- let [nameOfgame, exapnsOfGame] = game.split('-')
- if (acc.includes(nameOfgame)) {
- let index = acc.indexOf(nameOfgame);
- acc.splice(index, 1, nameOfgame, `${nameOfgame}:${exapnsOfGame}`)
- }
- } else if (command === 'Play!') {
- console.log(acc.join(' '))
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement