Solution is Right though not accepeted

function translatePigLatin(str) {
    let end = '';
    let regx = /[aeiou]/i;
    if (regx.test(str[0]) === true) return str += 'way';
    else {
        let result = str.match(regx);
        end = str.slice(0, result.index);
        str = str.slice(result.index, str.length);;
        return `${str}${end}ay`;
    }
}

translatePigLatin("consonant");

Although my solution is right and giving me right answer everytime but
but isn’t passing the test saying should handle without vowel what it means ??

Can anyone help me out ,

In Intermediate challenge of JS

Your solution is not correct. When your function is passed a word with no vowels in it, you have an error.

1 Like

why it so ? where I need to change can you help me out ??

If you look at the error in the console that I included, you will see that when str contains no vowels then result is null. You need to add logic to handle the situation where there are no vowels.

1 Like

Thanks for the help now I get that right , thanks again for your help

Congratulations. I’m glad I could help.