JavaScript Date constructor egenskab

Definition and usage

In JavaScript,constructor The property returns the constructor of the 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] }

Instance

The constructor property returns the constructor of the date:

var d = new Date();

Try it yourself

Syntax

Date.constructor

Technical details

Return value: function Date() { [native code] }
JavaScript version: ECMAScript 1

Browser understøttelse

Egenskaber Chrome IE Firefox Safari Opera
constructor Support Support Support Support Support

Relaterede sider

Tutorial:JavaScript dato

Tutorial:JavaScript datoformat

Tutorial:JavaScript objekt constructor