Problem Solving

Count Alphanumeric Chars

Write a function that counts the number of each alphanumeric character in the given string.

We want to return an object containing only the count of the alphanumeric characters that do appear on the input string.

The input string may contain uppercase characters but we count uppercase and lowercase characters as being the same. E.g. ā€œeā€ and ā€œEā€ are to be considered the same.

Unit Tests

Unresolved include directive in modules/ROOT/pages/problem-solving.adoc - include::example$src/04-problem-solving/countAlphaNum.test.ts[]

v1, reduce, regex

Unresolved include directive in modules/ROOT/pages/problem-solving.adoc - include::example$src/04-problem-solving/countAlphaNum-v1.ts[]

v2, regex, for …​ of loop

Unresolved include directive in modules/ROOT/pages/problem-solving.adoc - include::example$src/04-problem-solving/countAlphaNum-v2.ts[]

v3, isAlphaNum() helper with for …​ of loop

Unresolved include directive in modules/ROOT/pages/problem-solving.adoc - include::example$src/04-problem-solving/countAlphaNum-v3.ts[]