how to find the count of a char in a string js code example Example: javascript count character in string var str = "Hello World!"; var n = str.length;