JavaScript length property
Definition and Usage
length property returns the string length (number of characters).
grammar
string.length
Browser Support
All major browsers support length property
Examples
Examples
Returns the number of characters in the string:
<script>
var txt = "Hello World!";
document.write(txt.length);
</script>
var txt = "Hello World!";
document.write(txt.length);
</script>
Examples of the above output:
12
try it"
JavaScript String Object