Here goes a JavaScript oneliner
const pigIt = (s) => s.split(' ').map(e=>e.match(/\w/)?`${e.slice(1)}${e[0]}ay`:e).join(' ')
pigIt('Pig Latin is cool'); "igPay atinLay siay oolcay" pigIt('Hello world !'); "elloHay orldway !"
And just for fun, an unPigIt oneliner too!
const unPigIt = (s) => s.split(' ').map(e=>e.match(/\w/)?e[e.length-3]+e.slice(0,-3):e).join(' ')
unPigIt('igPay atinLay siay oolcay'); "Pig Latin is cool" unPigIt('elloHay orldway !'); "Hello world !"
Nailed it 👌🔥🔥
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.
Here goes a JavaScript oneliner
And just for fun, an unPigIt oneliner too!
Nailed it 👌🔥🔥