TypeScript bootcamp · Lab 44

Count vowels

easyStrings10 minLesson: Strings

Read the question, write TypeScript on the right, then Run or Check.

QuestionHint and solution stay closed until you open them

Count aeiou case-insensitive.

Examples

Example 1
Input
Hello
Output
2
Hint
  1. include check
Show correct code

Peek only after you have tried. You can still Check your own version.

const w: string = readLine().trim().toLowerCase();
let c = 0;
for (const ch of w) if ('aeiou'.includes(ch)) c++;
console.log(c);
main.tstsc · readLine() · Ctrl + Enter
ResultIdle
Run to see output. Check grades the tests.