String() constructor (Constructor)

A String object constructor.


ECMAScript edition - 2
JavaScript - 1.0
JScript - 1.0
Internet Explorer - 3.02
Netscape - 2.0
Property/method value type:String object
JavaScript syntax:-new String()
-new String(aValue)
Argument list:aValueSome value to be converted to a String object

When the String() constructor is used in a new expression it creates a new object based on the String prototype.

The value property of the new object is the same as the string that would have been returned when the constructor was invoked as a function call.

The result of this function is a String object version of the value passed-in. If there is no passed in argument an empty string "" is returned.

Refer to the String() conversion function topic for a list of rules for converting other data types to strings.


See also:Constructor function, constructor property, Global object, new, Object()


ECMA 262 edition 2 - section

ECMA 262 edition 2 - section 15.5.1

ECMA 262 edition 2 - section

ECMA 262 edition 3 - section 15.5.2