Quantcast
Viewing latest article 3
Browse Latest Browse All 43

Answer by Denise Ignatova for How to count string occurrence in string?

Here is my solution. I hope it would help someone

const countOccurence = (string, char) => {const chars = string.match(new RegExp(char, 'g')).lengthreturn chars;}

Viewing latest article 3
Browse Latest Browse All 43

Trending Articles