Ini this tutorial we’re going to learn how to get the value form array object and count only vowels value.
1st step create below file name
index.js
Put below code in index.js file
const stringArray = [
"Remember to customize the logout process according to your application's requirements, such as redirecting users to a different page after logout or performing additional actions."
];
function countVowels(str) {
const vowels = 'aeiouAEIOU';
let count = 0;
for (let char of str) {
if (vowels.includes(char)) {
count++;
}
}
return count;
}
stringArray.forEach(str => {
console.log(`Number of vowels in the string: ${countVowels(str)}`);
});
Next go to terminal and put below code
node index.js