How to use String in JavaScript

In this article I am going to explain about JavaScript String object.
  • 1483

JavaScript String object

JavaScript String refers to complete string object reference of the string. In string object all properties and method can be use to manipulate to the string. String object contain complete information about string. 

Example

In following example we are using toUpperCase properties of string object.

<html>

<head>

    <script type="text/javascript">

        function test() {

            var str = "welcome";

            document.write(str.toUpperCase());

        }

    </script>

</head>

<body>

    <button onclick="test()">

        click</button>

</body>

</html>

Output

 string1.gif

In fowling example we are using Length method of string object.

<html>

<head>

    <script type="text/javascript">

            function test() {

         var str = "welcome";

            document.write(str.length);

        }

    </script>

</head>

<body>

    <button onclick="test()">click</button>

</body>

</html>

Output

 string1.gif

Further Readings

You may also want to read these related articles: here
Ask Your Question 

Got a programming related question? You may want to post your question here

Categories

More Articles

© 2013 dotNetheaven. All rights reserved.