Thank you. As you said, Except the way I use the function, there was an error for words that start with a consonant. I solved it by switching str.substring(0, i) and str.substring(i). But what should I do for words without vowels? I tried to return str without any changes but it didn’t work.
you would still need to move the consonant cluster to the end of the word and add ay, just that in this case the cluster is the whole word. So you just add “ay” at the end of the word