Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function cutAndReverse(str) {
- let arr = [];
- let firstPart = str.substr(0, str.length / 2);
- arr.push(firstPart);
- let secondPart = str.substr(str.length / 2, str.length);
- arr.push(secondPart)
- for (let element of arr) {
- console.log(element.split("").reverse().join(""))
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment