Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions L-B/0015 CheckVowelOrConsonant (L-B)/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Problem 15 (L-B) ~ Check Vowel or Consonant

## Problem

This program takes an *English* alphabet and informs the user if the given alphabet is a vowel or a constant.

### Vowels

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**.

### Consonants

In articulatory phonetics, a consonant is a speech sound that is articulated with complete or partial closure of the vocal tract.
Examples of consonants are: **Z**, **B**, **T**, **G**, and **H**.
11 changes: 11 additions & 0 deletions L-B/0015 CheckVowelOrConsonant (L-B)/checkVowelOrConsonant.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const vowels = ["a", "e", "i", "o", "u", "A", "E", "I", "O", "U"];

const checkVowelOrConsonant = (letter) => {
if (vowels.includes(letter)) {
return `${letter} is a VOWEL`;
} else {
return `${letter} is a CONSONANT`;
}
};

module.exports = checkVowelOrConsonant;
10 changes: 10 additions & 0 deletions L-B/0015 CheckVowelOrConsonant (L-B)/checkVowelOrConsonant.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const { strict: assert } = require("assert");

const checkVowelOrConsonant = require("./checkVowelOrConsonant.js");

assert.equal(checkVowelOrConsonant("a"), "a is a VOWEL");
assert.equal(checkVowelOrConsonant("E"), "E is a VOWEL");
assert.equal(checkVowelOrConsonant("b"), "b is a CONSONANT");
assert.equal(checkVowelOrConsonant("C"), "C is a CONSONANT");

console.log("All tests success");