Tutorials » Javascript tutorials »

The JavaScript String object


This article explains about String object into depth.


String Object:


String is nothing but a piece of text. The purpose of string object is to work over text. This is most commonly used object. String object has only one property called length . This returns length of the string.

Syntax:


string.length where string is the variable of type string.

Example



<html>

<head>

<title>JavaScript Tutorials</title>

</head>

<body>

The lengh of the string is :

<script language ="JavaScript">

var v="Dotnet Spider";

document.write(v.length);

</script>

</body>

</html>



output


The above example shows output in browser as The lengh of the string is : 13

var v="Dotnet Spider"; creates a string called V and stores the specified text as Dotnet Spider.
The length of the string is computed using length property .As the string length is 13 it's displayed on browser.





Next Chapter: The string Object
Previous Chapter: JavaScript Objects
More Chapters: Javascript Tutorials
More Tutorials: Tutorial Index



Top Contributors
Today
    Last 7 Daysmore...

    Awards & Gifts

    Online Members

    More...
     
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India