Advertisement
ErolKZ

Untitled

Oct 28th, 2021
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1.  
  2. function solve (arr) {
  3.  
  4.  
  5. let countSongs = arr.shift();
  6.  
  7. let typeOflist = arr.pop();
  8.  
  9.  
  10. // class Song {
  11.  
  12. // constructor (typeList, name, time) {
  13.  
  14. // this.typeList = typeList;
  15.  
  16. // this.name = name;
  17.  
  18. // this.time = time;
  19.  
  20. // }
  21.  
  22. // }
  23.  
  24.  
  25.  
  26. for (let i = 0; i < countSongs; i++) {
  27.  
  28. let curr = arr[i].split('_');
  29.  
  30. // console.log(curr);
  31.  
  32. if (curr[0] === typeOflist) {
  33.  
  34. console.log(curr[1]);
  35.  
  36. } else if (typeOflist === 'all') {
  37.  
  38. console.log(curr[1]);
  39.  
  40. }
  41.  
  42.  
  43. }
  44.  
  45.  
  46.  
  47.  
  48.  
  49. }
  50.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement