program to find number of characters in a string in javascript code example Example: javascript count character in string var str = "Hello World!"; var n = str.length;