JavaScript Date constructor property

Definitie en gebruik

In JavaScript:constructor Eigenschappen retourneren de constructor van het object.

De terugwaarde is een verwijzing naar de functie, niet de naam van de functie:

Voor JavaScript-daten retourneert de constructor-eigenschap:function Date() { [natieve code] }

Voor JavaScript-getallen retourneert de constructor-eigenschap:function Number() { [natieve code] }

Voor JavaScript-strings retourneert de constructor-eigenschap:function String() { [natieve code] }

Instantie

De constructor-eigenschap retourneert de constructor van de datum:

var d = new Date();

Probeer het zelf

Syntaxis

Date.constructor

Technische details

Terugwaarde: function Date() { [natieve code] }
JavaScript versie: ECMAScript 1

Browser support

Properties Chrome IE Firefox Safari Opera
constructor Support Support Support Support Support

Related pages

Tutorial:JavaScript date

Tutorial:JavaScript date format

Tutorial:JavaScript object constructor