Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function games(arr) {
- let gameAcc = arr[0];
- for (let i = 1; i < arr.length; i++) {
- if (arr[i].includes("Install")) {
- let currentGame = arr[i].pop();
- gameAcc.push(currentGame);
- }
- }
- console.log(gameAcc);
- }
- games([
- "CS WoW Diablo",
- "Install LoL",
- "Uninstall WoW",
- "Update Diablo",
- "Expansion CS-Go",
- "Play!",
- ]);
Advertisement
Add Comment
Please, Sign In to add comment