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
- <html>
- <body>
- <script type="text/javascript">
- // both single & double quote works
- var str='College of Computer Science'
- document.write("<p>" + str + "</p>")
- document.write(str.length)
- </script>
- </body>
- </html>
0 comments:
Post a Comment