[Solved][Beta] Pig Latin - Words without vowels

How should we handle words without vowels?

It is the last test and I’m not sure what needs to be done to complete it.

Thanks in advance :slight_smile:

I had an inner function that handled words that started with a consonant. Its purpose was to move that consonant to the end of the word and append “ay.”

Then I ran a for loop that checked each word. If one started with a vowel I just appended “way” and pushed that to the result array.

A word like “my” without a,e,i,o, or u would fall in that first category, wouldn’t it? It would end up being “ymay.”

I had it return just the word ‘my’ and also return ‘ymay’ and it’s still not passing the final test.

Thanks though, I thought this was going to work!

Well with pig Latin y is considered a vowel when there aren’t any others. Words with out vowels just end in “ay” I would run the test with gibberish words. Something like “dgfgh”. That should return “dgfghay”. You could run a for loop and make an if statement saying if no vowels are are found return word + ay. Hopefully that helps.

2 Likes

That did it! Returning the word + ay is the correct return! Thank you so much!!

LOL. Classic. The coding challenge wasn’t won by code, but by a superior knowledge of pig latin. Good work!

1 Like

Well, to be fair, in the English language ‘y’ is used as a vowel most of the time.