Pig Latin - The task does not specify how to handle words without vowels

Tell us what’s happening:

The task does not specify how to handle words without vowels, so in order to complete the task, how to handle words without vowels?

Your code so far

function translatePigLatin(str) {
  const voc = 'aeiouy';
  if(voc.includes(str[0])) {
     return str + 'way';
  } else {
    let i = 0;
    while (i<str.length && !voc.includes(str[i])) {
    if(i == str.length){
      // word without vowels?, the task does not specify how to handle 
      return  str + 'ay'; // does not pass!
    return str.slice(i) + str.slice(0,i) + 'ay' ;

console.log(translatePigLatin("qwrt")); // word without wovels, but it does not pass with 'qwrtay', why?

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36.

Link to the challenge:

Ah, but it does mention it, just not explicitly. :slight_smile:
If all letters in a word are consonants, that would make the whole word a consonant cluster.

1 Like

Yes, so the test should pass with “qwrtay”, but it does not

Passed it, but is the letter ‘y’ not a vocal?

Typically in English only a, e, i, o, and u are considered vowels. I understand your confusion though, since I also thought of ‘y’ as a vowel before.

1 Like

Ok, I learned something new - not a native speaker as you might understand - thanks for the clarification