I'm trying to write a simple Pig Latin code. I want to check if the first letter of the input string is a vowel, if so then to run that certain code. How can I ask if y is equal to one of those values.
function pigLatin() {
var y = prompt("Enter a word:")
if (y.charAt(0) = a,e,i,o,u) {
var pigLatin = y + "ay";
document.getElementById("answer").innerHTML = "Answer is: " + pigLatin;
} else {
var wordLength = y.length + 1;
var pigLatin = y.substring(1, wordLength) + y.charAt(0) + "ay";
document.getElementById("answer").innerHTML = "Answer is: " + pigLatin;
}
}