how to check a string length in javascript code example Example: length of string in javascript var str = "Hello World!"; var n = str.length;