constructor

优质
小牛编辑
124浏览
2023-12-01

描述 (Description)

Javascript日期constructor属性返回对创建实例原型的数组函数的引用。

语法 (Syntax)

其语法如下 -

date.constructor

返回值 (Return Value)

返回创建此对象实例的函数。

例子 (Example)

请尝试以下示例。

<html>
   <head>
      <title>JavaScript Date constructor Property</title>
   </head>
   <body>
      <script type="text/javascript">
         var dt = new Date();
         document.write("dt.constructor is : " + dt.constructor); 
      </script>
   </body>
</html>

输出 (Output)

dt.constructor is: function Date() { [native code] }