count same characters in string javascript