Anonimka

Untitled

May 23rd, 2019
587
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve (input) {
  2.     let rotations=input.pop();
  3.     for (let i = 0; i < rotations; i++) {
  4.         input.unshift(input.pop());
  5.     }  
  6.     console.log(input.join(' '));
  7. }
  8. solve(['Banana',
  9. 'Orange',
  10. 'Coconut',
  11. 'Apple',
  12. '15']
  13. );
Advertisement
Add Comment
Please, Sign In to add comment