JavaScript program to count the number of vowels in a string:
function countVowels(str) {
let vowels = "aeiouAEIOU";
let count = 0;
for (let i = 0; i < str.length; i++) {
if (vowels.indexOf(str[i]) != -1) {
count++;
}
}
return count;
}
console.log(countVowels("javascript"));