simple pig latin

samuel Jo·2022년 12월 10일
0

codewars

목록 보기
13/46

//문제

DESCRIPTION:
Move the first letter of each word to the end of it, then add "ay" to the end of the word. Leave punctuation marks untouched.

띄어쓰기나 특수문자일 경우 그대로 반환해야함. (정규식이용)

Examples
pigIt('Pig latin is cool'); // igPay atinlay siay oolcay
pigIt('Hello world !'); // elloHay orldway !

Array.prototype.join을 통해 배열을 다시 문자열로 바꿔줘야함.

정규식 사용에 익숙해져야 할듯.

var str = "hello";
var str1=str.substr(1); // 'ello'
var str2= str.substr(0,1); //'h' 
str1+str2 // 'elloh'
profile
step by step

0개의 댓글