String.length (Property)

The length of a String object's value.


ECMAScript edition - 2
JavaScript - 1.0
JScript - 1.0
Internet Explorer - 3.02
Netscape - 2.0
Netscape Enterprise server - 2.0
Opera - 3.0
Property/method value type:Number primitive
JavaScript syntax:-myString.length

The length of the String object's value measured in characters.

All String objects inherit properties and methods from the String prototype object. They will all return a value as a result of requesting the length property.

The length value of a String object is immutable.

This suggests that changing the value of a String object actually creates a new String object. This explains why continual string concatenations and modifications can sometimes cause a JavaScript execution to leak large amounts of memory as it runs.

See also:String object, String.prototype

Property attributes:

ReadOnly, DontDelete, DontEnum.


ECMA 262 edition 2 - section 15.5.5

ECMA 262 edition 3 - section