Qualified percentage’s is 50%
function countVowels (inputString) {
// Convert the string to lowercase to handle both upper and lower case vowels
inputString = inputString.toLowerCase();
let vowelCount = 0;
for (let char of inputString) {
}
}
if [char === 'a' || char === 'e' || char === 'i' || char === 'o' || char === 'u'] {
vowelCount++;
}
return vowelCount;
// Example usage:
const testString = "Hello World";
const result = countVowels (testString);
console.log("Number of vowels in the string:", result);
function countVowels (inputString)
{
Convert the string to lowercase to handle both upper and lower case vowels inputString =
inputString.toLowerCase();
let vowelCount = 0;
for (let char of inputString)
{
if (char === 'a' || char === 'e' || char === 'i' || char === 'o' || char === 'u')
{
vowelCount++; return vowelCount;
}
Let sum = 1;
for(let i=2;i<=5;i++)
{
sum*=i;
}
console.log(sum)
Rating of coding : Rating 2
Comments on Coding : The candidate accurately identified and rectified the syntax error in the if statement for checking vowels.