Advertisement
bai_onzi

zad4. arrays

Feb 15th, 2023
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let input = ['5,3,2,1', 2];
  2.  
  3.  
  4. let gets = this.gets || ((arr, index) => () => arr[index++])(input, 0);
  5.  
  6. let list = gets().split(',');
  7.  
  8. let n = +gets();
  9. let result = [];
  10.  
  11. let rotatedEl;
  12.  
  13. for(let i = 0; i < n; i++){
  14.     let removedElement = list.shift();
  15.     removedElement == 1;
  16.     rotatedEl = list.push(removedElement);
  17.  
  18. }
  19. console.log(list.join(','))
  20.  
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement