Sponsored Ad

Thursday, January 28, 2010

JavaScript String Variable

This is sample program to demonstrate JavaScript string variable. JavaScript string support verity of string functions here is a demo of length. Length function is used to calculate string length.

 

Code Snippet
  1. <html>
  2. <body>
  3. <script type="text/javascript">
  4. // both single & double quote works
  5. var str='College of Computer Science'
  6. document.write("<p>" + str + "</p>")
  7. document.write(str.length)
  8. </script>
  9. </body>
  10. </html>

0 comments:

Post a Comment

Sponsored Ad

More Related Articles

Website Update

Followers