Algorithms1 Pig Latin | match(), regexp, replace(), concat() Problem> Pig Latin is a way of altering English Words. The rules are as follows: - If a word begins with a consonant, take the first consonant or consonant cluster, move it to the end of the word, and add "ay" to it. - If a word begins with a vowel, just add "way" at the end. Solution> function pigIt(str) { let regex = /^[^aeiou]+/; let consonant = str.match(regex); return consonant !== null ? s.. 2020. 12. 30. 이전 1 다음