Advertisement
Todorov_Stanimir

07. Cut and Reverse

Jul 19th, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function cutAndReverse(input) {
  2.     let firstHalf = input.substr(0, input.length / 2);
  3.     let secondHalf = input.substr(input.length / 2, input.length / 2);
  4.     splitReverseJoin([firstHalf, secondHalf]);
  5.  
  6.     function splitReverseJoin(argument) {
  7.         argument.forEach(element => {
  8.             let result = element.split('').reverse().join('');
  9.             console.log(result);
  10.         });
  11.     }
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement