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