68
rated 0 times
[
72]
[
4]
/ answers: 1 / hits: 21925
/ 8 Years ago, fri, april 15, 2016, 12:00:00
I am making a javascript function that tell the user whether the letter they entered is a vowel or consonant. I have tried to make a function but without success. Please someone show whats going on and how to fix it.
Many Thanks
James
function letter() {
var
let = prompt(Your Letter);
if (let == 'a' ||
let == 'e' ||
let == 'i' ||
let == 'o' ||
let == 'u') {
alert(Your letter is a vowel);
} else {
alert(Your letter is a consonant);
}
<!DOCTYPE html>
<html>
<head>
<script>
function letter() {
var
let = prompt(Your Letter);
if (let == 'a' ||
let == 'e' ||
let == 'i' ||
let == 'o' ||
let == 'u') {
alert(Your letter is a vowel);
} else {
alert(Your letter is a consonant);
}
</script>
</head>
<h3>Vowel or Consonant</h3>
<input id=prompt type=text />
<p id=answer></p>
<button onclick=letter()>Check letter</button>
</body>
</html>
More From » javascript