count number of specific characters in a string javascript