how to count char in string in javascriopt code example Example: javascript count character in string var str = "Hello World!"; var n = str.length;