function a_or_an(
word)
{
/* basic strategy: make character lower case since "aeiou" are all lower case, then see if the character is in the string "aeiou"; indexes for vowels are 0, 1, 2, 3, and 4n.
indexOf returns the location of the character in a string; if it's not found it returns -1
*/
//grabs first letter of word (like caps function)
var
firstLetter =
word.charAt(0);
//create list of vowels
var vowels = "aeiou";
if (vowels.indexOf(firstLetter.toLowerCase()) < 0)
{
/* indexOf returns -1 if char not found in string */
return 'a ' + word;
}
else
{
return 'an ' + word;
}
}