返回给定字符串中元音的数量
DESCRIPTION
Return the number (count) of vowels in the given string.
We will consider a, e, i, o, u as vowels for this Kata (but not y).
The input string will only consist of lower case letters and/or spaces.
SOLUTION
- 方法一:数组的
includes()
方法
1 | function getCount(str) { |
- 方法二:利用正则表达式
1 | function getCount(str) { |
- 方法三:
filter()
方法
1 | function getCount(str) { |