Learn JavaScript and Ajax with w3schools
Examples The following example shows how to return the length of a string. Your results are shown in Figure 15.1.
Try it yourself >> <html> <body> <script type="text/javascript"> var txt = "Hello World!"; document.write(txt.length); </script> </body> </html>
Figure 15.1
The following example demonstrates how to use the methods of the String object to style strings. Your results are shown in Figure 15.2.
Try it yourself >> <html> <body> <script type="text/javascript"> var txt = "Hello World!";
82