javascript count certain characters in string