Hi Guys,
I am trying to design a function that will strip out all the vowels from a string and I cannot get this part right for the life of me! Please help.
Here is my first function which tells us if a character is a vowel and it works fine, now I am trying to use this function within the code below it but I am not sure if my arguments are right.
function isVowel(aCharacter)
/************************************************************************/
/
/* a function to check whether a given character is a vowel /
/
{
return ((aCharacter == ‘a’) || (aCharacter == ‘A’)||
(aCharacter == ‘e’) || (aCharacter == ‘E’)||
(aCharacter == ‘i’) || (aCharacter == ‘I’)||
(aCharacter == ‘o’) || (aCharacter == ‘O’)||
(aCharacter == ‘u’) || (aCharacter == ‘U’))
};
Here is my problem!
function dropVowels(aString)
/************************************************************************/
/
/* a function to drop the vowels in a string /
/
{
var resultString = ”;
for (var result = 0; result <= aString.length; result = result + 1)
{
if (aString.charAt(result) != isVowel (aString.charAt(result)))
resultString = aString.charAt(result)
};
return resultString
};
Thanks guys