- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Number of vowels within an array in JavaScript
We are required to write a JavaScript function that takes in an array of strings, (they may be a single character or greater than that). Our function should simply count all the vowels contained in the array.
Example
Let us write the code −
const arr = ['Amy','Dolly','Jason','Madison','Patricia']; const countVowels = (arr = []) => { const legend = 'aeiou'; const isVowel = c => legend.includes(c); let count = 0; arr.forEach(el => { for(let i = 0; i < el.length; i++){ if(isVowel(el[i])){ count++; }; }; }); return count; }; console.log(countVowels(arr));
Output
And the output in the console will be −
10
- Related Articles
- Finding confusing number within an array in JavaScript
- Finding the third maximum number within an array in JavaScript
- Find average of each array within an array in JavaScript
- Find average of each array within an array JavaScript
- Counting possible APs within an array in JavaScript
- Chunking array within array in JavaScript
- Checking for vowels in array of numbers using JavaScript
- Counting number of vowels in a string with JavaScript
- How to redundantly remove duplicate elements within an array – JavaScript?
- Update an array of strings nested within an array of objects in MongoDB
- How to get a number of vowels in a string in JavaScript?
- Armstrong number within a range in JavaScript
- Filtering array within a limit JavaScript
- Finding unlike number in an array - JavaScript
- Sum identical elements within one array in JavaScript

Advertisements