function isVowel(character) {
const vowels = ['a','e','i','o','u']
return vowels.indexOf(character) == -1
}
function countVowelConsonant(str) {
const arr = [...str]
let sum = 0
for(i = 0; i < arr.length; i++) {
if(isVowel(arr[i])) {
sum = sum + 2
} else {
sum = sum + 1
}
}
return sum
}
/**
* 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);
});
});