THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

JavaScript Date constructor Property

Date Object Reference JavaScript Date Object

Example

The constructor property returns a date's constructor function:

var d = new Date();

The constructor property returns:

function Date() { [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 dates the constructor property returns function Date() { [native code] }

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

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


Browser Support

Property
constructor Yes Yes Yes Yes Yes

Syntax

Date.constructor

Technical Details

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

Date Object Reference JavaScript Date Object