From http://www.w3schools.com (Copyright Refsnes Data)

JavaScript length Property


String Object Reference JavaScript String Object

Definition and Usage

The length property returns the number of characters in a string.

Syntax

stringObject.length


Example

Example

Return the number of characters in a string:

<script type="text/javascript">

var txt="Hello World!";
document.write(txt.length);
</script>

The output of the code above will be:

12

Try it yourself »


String Object Reference JavaScript String Object

From http://www.w3schools.com (Copyright Refsnes Data)