Latest

recent

JavaScript length Property

Definition and Usage

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

Syntax

stringObject.length


Example

In this example we will show how to use the length property to 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
JavaScript length Property Reviewed by 1000sourcecodes on 02:22 Rating: 5
Powered by Blogger.