I am wondering what does the $1$2 do? My understanding is that they are
**Your code so far**
function translatePigLatin(str) {
return str
.replace(/^[aeiou]\w*/ , '$&way')
.replace(/(^[^aeiou]+)(\w*)/, '$2$1ay')
}
console.log(translatePigLatin("shwartz"));
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36
Challenge: Pig Latin
Link to the challenge: