# Find no. of vowels(a,e,i,o,u) in a string


```
(Javascript)

*ex. →vowelsCount(‘*hi there*’) → 3*

### Sol. 1

vowelsCount = (str) => {

let count = 0;

for (let char of str) {

if (‘aeiou’.includes(char.toLowerCase())) {

count++

}

}

console.log(count)

return count;

}

vowelsCount(‘hi there’)
``` 


### Sol. 2


```
vowelsCount = (str) => {

let count = 0;

const matchedArray = str.match(/\[aeiou\]/gi);

if (matchedArray) {

count = matchedArray.length;

}

return count

}

console.log(vowelsCount(‘hi there’))
``` 


![](https://cdn.hashnode.com/res/hashnode/image/upload/v1639214197286/BNOKeedUB.png)

Happing Coding… 👏👏
