vowels consonants javascript
//Ask to the user to type a letter
function readLetter() {
return prompt("Type a letter: ");
}
//Defines true if is a vowel(uppercase or lowercase);
function isVowel(character) {
switch (character) {
case "a":
case "A":
case "e":
case "E":
case "i":
case "I":
case "o":
case "O":
case "u":
case "U":
return true;
default:
return false;
}
}
// Brings a dependent message if previous result is true or false.
var letter = readLetter();
if (isVowel(letter)) alert("The letter is a vowel.");
else alert("The letter is consonant.");
Also in JavaScript:
- toggle class javascript stack overflow
- jquery ready
- div click outside to hide javascript
- take a screen shot of a image within a div using js
- Math.ceil
- add an image to a div with javascript
- list listener on a page js
- nodemon : The term 'nodemon' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + nodemon index
- javascript factor chain
- afficher une variable dans la console javascript
- closures in javascript
- json parse
- all fields entered jquery enable submit button
- jquery preventdefault
- express file upload mv
- javascript base64url decode
- addclass javascript
- react proptypes example
- rotate a div using javascript
- FizzBuzz
- fetch download blob file
- inline if else javascript
- javascript uncheck radio button
- npm ERR! Unexpected end of JSON input while parsing near '...r\nComment: https://o'