Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function tseamAccount(input) {
- let account = input[0];
- let accountArr = account.split(" ");
- input.splice(0, 1);
- let command = [];
- for (i = 0; i < input.length; i++) {
- command = input[i].split(" ");
- if (command[0] === 'Install' && accountArr.includes(command[1]) === false) {
- accountArr.push(command[1]);
- }
- else if (command[0] === 'Uninstall' && accountArr.includes(command[1]) === true) {
- for (j = 0; j < accountArr.length; j++) {
- if (accountArr[j] === command[1]) {
- accountArr.splice(j, 1);
- }
- }
- }
- else if (command[0] === 'Update' && accountArr.includes(command[1]) === true) {
- for (j = 0; j < accountArr.length; j++) {
- if (accountArr[j] === command[1]) {
- accountArr.splice(j, 1);
- accountArr.push(command[1]);
- }
- }
- }
- else if (command[0] === 'Expansion') {
- let expArr = command[1].split("-");
- for (j = 0; j < accountArr.length; j++) {
- if (accountArr[j] === expArr[0]) {
- // accountArr[j] = accountArr[j] + " " + accountArr[j] + ":" + expArr[1];
- accountArr.splice(j + 1, 0, `${expArr[0]}:${expArr[1]}`);
- break;
- }
- }
- } else if (command[0] === "Play!") {
- break;
- }
- }
- console.log(accountArr.join(" "));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement