Neri0817

Untitled

Jan 28th, 2022
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function games(arr) {
  2.   let gameAcc = arr[0];
  3.  
  4.   for (let i = 1; i < arr.length; i++) {
  5.     if (arr[i].includes("Install")) {
  6.       let currentGame = arr[i].pop();
  7.       gameAcc.push(currentGame);
  8.     }
  9.   }
  10.   console.log(gameAcc);
  11. }
  12.  
  13. games([
  14.   "CS WoW Diablo",
  15.   "Install LoL",
  16.   "Uninstall WoW",
  17.   "Update Diablo",
  18.   "Expansion CS-Go",
  19.   "Play!",
  20. ]);
Advertisement
Add Comment
Please, Sign In to add comment