X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

JavaScript String constructor Property

JavaScript String Reference JavaScript String Reference

Example

The constructor property returns the string's constructor function:

var str = "Hello World!";

The constructor property returns:

function String() { [native code] }

Try it yourself »


Definition and Usage

In JavaScript, the constructor property returns the constructor function for an object.

The return value is a reference to the function, not the name of the function:

For JavaScript numbers the constructor property returns function Number() { [native code] }

For JavaScript strings the constructor property returns function String() { [native code] }

For JavaScript booleans the constructor property returns function Boolean() { [native code] }


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The constructor property is supported in all major browsers.


Syntax

string.constructor

Technical Details

Return Value: function String() { [native code] }
JavaScript Version: 1.1


JavaScript String Reference JavaScript String Reference

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook