Advertisement
kstoyanov

07. Cut and Reverse

Jul 17th, 2020
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve(args) {
  2.   const half = args.length / 2;
  3.   const firstPart = args.substr(0,half);
  4.   const secondPart = args.substr(half);
  5.  
  6.   const reversFirsPart = firstPart.split('').reverse();
  7.   const reversSecondPart = secondPart.split('').reverse();
  8.  
  9.   console.log(reversFirsPart.join(''));
  10.   console.log(reversSecondPart.join(''));
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement