<html>
<body>
<h1> Count vowel</h1>
<script>
let str = " hello, world!";
let vowelCount = 0;
// convert string to lowercase to handle both uppercase and lowercase vowels
str = str.toLowerCase();
// loop through the characters in the string and count the vowels
for (let i = 0; i < str.length; i++) {
if (str[i] === 'a' || str[i] === 'e' || str[i] === 'i' || str[i] === 'o' || str[i] === 'u') {
vowelCount++;
}
}
alert(vowelCount);
</script>
</body>
</html>