題目說明:
函式帶入字串判斷有幾個母音(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;
}
}
}



![[React] React Hook 是什麼?](https://static.coderbridge.com/img/hohobbt/891da4f72aa14986a7c2fe44c86e715a.jpg)