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

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

#1

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:


#2

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.”


#3

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!


#4

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.


#5

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


#6

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


#7

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