Quantcast
Viewing all articles
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 all articles
Browse latest Browse all 43

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>