Files
30-seconds-of-code/snippets/countVowels.md
Stefan Feješ d8c41260da Add countVowels
2017-12-18 20:07:44 +01:00

13 lines
291 B
Markdown

### countVowels
Retuns `number` of vowels in provided string.
Use a regular expression to count number of vowels `(A, E, I, O, U)` in a `string`.
```js
const countVowels = str =>
return (str.match(/[aeiou]/ig) || []).length;
// countVowels('foobar') -> 3
// countVowels('gym') -> 0
```