Javascript Reference - JavaScript String length Property








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

The length of an empty string is 0.

Browser Support

length Yes Yes Yes Yes Yes

Syntax

stringObject.length;

Return Value

The length of a string.

Example


var stringValue = "hello world"; 
console.log(stringValue.length); //"11" 

The code above generates the following result.