Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

JavaScript length Property

JavaScript length Property

String Object Reference JavaScript String object


Definition and Usage

The length property returns the length of a string (number of characters).

Syntax

string

.length


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the length property.


Example

Example

Return the number of characters in a string:

The output of the above example is:

12

Try it »


String Object Reference JavaScript String object