題目說明:
函式帶入字串判斷有幾個母音(a,e,i,o,u)
code
export class Kata {
static getCount(str: string): number {
//code
const lowerCaseStr = str.trim().toLowerCase();
const regex = /[aeiou]/g;
const matches = lowerCaseStr.match(regex);
if (matches) {
return matches.length;
} else {
return 0;
}
}
}
![[ JavaScript 02 ] 變數](https://static.coderbridge.com/images/covers/default-post-cover-1.jpg)
![[ 筆記 ] JavaScript 進階 04 - Hoisting](https://static.coderbridge.com/img/krebikshaw/c2779882655a4fad9426f89bad492538.jpg)
