//1. input words beginning and ending with a vowel are preserved in lowercase
//2. input words beginning with vowels and ending in a non vowel are translated to uppercase
//3. input words beginning with a non vowel and ending with a vowel are translated to a capitalized word (only first letter is uppercase)
//4. when printing the words, only two vowels are preserved per word (the first two)
//Output "i dont know Dude i AM not typing ALL OF this Nonsens text"
var str = "i dont know dude i am not typing all of this nonsense text";
console.log(str);
var res = str.split(" ");
console.log(res);
for(let i = 0; i<res.length;i++){
//checking words after spliting into single words
if((res[i].split("") && (res[0] ==== 'a'|| 'e' || 'o' || 'u' || 'i' || 'y') && (/* last charachter to check */ ))
}
I am beginner JavaScript Developer and i am having some difficulties with my exercise i have above 4 conditions first i split the array into a words then i hoped to split into single characters so res[0] will be my first item . I dont know if this will work but at least i need to try. Any help will be very appreciated even if it is with regular expressions. Thank you