How did i do on this one?

Tell us what’s happening:

  **Your code so far**

function translatePigLatin(str) {
let consonants = str.match(/^[bcdfghjklmnpqrstvwxys]{1,}/gi);
if (consonants) {
  return str.slice(consonants[0].length,) + consonants + "ay";
}
  return str + "way";
  }
translatePigLatin("california");
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36.

Challenge: Pig Latin

Link to the challenge:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.