Skip to content

Commit 644e354

Browse files
authored
Merge pull request #27 from AhorIsaac/AhorIsaac
add new problem : check vowel or consonant (L-B)
2 parents 245983a + 5032cc3 commit 644e354

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Problem 15 (L-B) ~ Check Vowel or Consonant
2+
3+
## Problem
4+
5+
This program takes an *English* alphabet and informs the user if the given alphabet is a vowel or a constant.
6+
7+
### Vowels
8+
9+
A vowel is a letter that represents an open sound. When we make a vowel sound, we don't obstruct the airflow with the lips or tongue. In the English alphabet, there are five vowels and they are: **a**, **e**, **i**, **o**, and **u**.
10+
11+
### Consonants
12+
13+
In articulatory phonetics, a consonant is a speech sound that is articulated with complete or partial closure of the vocal tract.
14+
Examples of consonants are: **Z**, **B**, **T**, **G**, and **H**.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const vowels = ["a", "e", "i", "o", "u", "A", "E", "I", "O", "U"];
2+
3+
const checkVowelOrConsonant = (letter) => {
4+
if (vowels.includes(letter)) {
5+
return `${letter} is a VOWEL`;
6+
} else {
7+
return `${letter} is a CONSONANT`;
8+
}
9+
};
10+
11+
module.exports = checkVowelOrConsonant;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const { strict: assert } = require("assert");
2+
3+
const checkVowelOrConsonant = require("./checkVowelOrConsonant.js");
4+
5+
assert.equal(checkVowelOrConsonant("a"), "a is a VOWEL");
6+
assert.equal(checkVowelOrConsonant("E"), "E is a VOWEL");
7+
assert.equal(checkVowelOrConsonant("b"), "b is a CONSONANT");
8+
assert.equal(checkVowelOrConsonant("C"), "C is a CONSONANT");
9+
10+
console.log("All tests success");

0 commit comments

Comments
 (0)