JavaScript Date constructor Attribute

定义和用法

在 JavaScript 中,constructor 属性返回对象的构造函数。

返回值是对函数的引用,而不是函数的名称:

对于 JavaScript 日期,constructor 属性返回:function Date() { [native code] }

对于 JavaScript 数字,constructor 属性返回:function Number() { [native code] }

对于 JavaScript 字符串,constructor 属性返回:function String() { [native code] }

实例

constructor 属性返回日期的构造函数:

var d = new Date();

亲自试一试

语法

Date.constructor

技术细节

返回值: function Date() { [native code] }
JavaScript 菲律宾文版本: ECMAScript 1

Browser Support

Attribute Chrome IE Firefox Safari Opera
constructor Support Support Support Support Support

Related Pages

Tutorial:JavaScript Date

Tutorial:JavaScript Date Format

Tutorial:JavaScript Object Constructor