Hello Raffaele,
Here is my solution :) BTW, I really like, how you solved with array destruction. Well done :)
const strManipulation = (str) => { let strArr = str.split(' '); const appendStr = 'ay'; let finalText = ""; let regex = new RegExp('[^a-zA-Z\d\s: ]', 'g'); strArr.forEach((item) => { let nonAlphabetStartIndex = item.search(regex); if(nonAlphabetStartIndex){ finalText += `${item.slice(1, nonAlphabetStartIndex)}${item.charAt(0)}${appendStr}${item.slice(nonAlphabetStartIndex)} `; } else{ finalText += `${item.slice(1)}${item.charAt(0)}${appendStr} `; } }); return finalText.trimEnd(); };
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hello Raffaele,
Here is my solution :) BTW, I really like, how you solved with array destruction. Well done :)