function countVowelConsonant(str) {
// write code here
const word = str.split('');
const vowels = ['a','e','i','o','u'];
let points = 0;
for (let i = 0; i < word.length; i++) {
for (let j = 0; j < word.length; j++) {
if (word[i] === vowels[j]) {
points++;
}
}
}
points = word.length * 2 - points;
return points;
}
/**
* Test Suite
*/
describe('countVowelConsonant()', () => {
it('returns total of vowels(1) and consonants(2) to be added', () => {
// arrange
const value = 'abcde';
// act
const result = countVowelConsonant(value);
// log
console.log("result: ", result);
// assert
expect(result).toBe(8);
});
});