Skip to content

Commit 7b150ba

Browse files
problem 64 solved
1 parent 4e025b6 commit 7b150ba

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

problem62/problem62.js

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/* =====================================================================
2+
------ Programme for calculating Total vowels and consonants --------
3+
===================================================================== */
4+
5+
const countVowelsAndConsonants = textInput => {
6+
const allLetters = textInput.toLowerCase();
7+
const vowels = 'aeiou';
8+
let vowelsCount = 0 ;
9+
let consonantsCount = 0;
10+
11+
for ( let i = 0; i < allLetters.length; i++){
12+
let letter = allLetters[i];
13+
14+
if(/[a-z]/.test(letter)){
15+
16+
if(vowels.includes(letter)){
17+
vowelsCount++;
18+
}
19+
else{
20+
consonantsCount++;
21+
}
22+
}
23+
24+
};
25+
return {yourInput: textInput, totalVowels: vowelsCount, totalConsonants: consonantsCount};
26+
};
27+
28+
console.log( countVowelsAndConsonants("developer.shourav1@gmail.com"));

0 commit comments

Comments
 (0)