length
String
instance propertyS2C Home
« Globals « String « length
Description
Returns a positive integer holding the number of characters within the string.
Syntax
Signature | Description |
---|---|
aString.length | Returns a positive integer holding the number of characters within the string. |
Parameters
None.
Examples
The code below a string and displays the string and length.
// Create a string with a length of 16.
var aString = new String('Learn JavaScript');
alert(aString + ' - ' + aString.length);
Related Tutorials
JavaScript Basic Tutorials - Lesson 8 - Strings