无涯教程-Javascript - constructor构造函数

47 阅读1分钟

JavaScript date constructor 构造函数属性返回对创建原型的数组函数的引用。

constructor - 语法

date.constructor

constructor - 返回值

返回创建此对象的函数。

constructor - 示例

<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>

运行上面代码输出

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

参考链接

www.learnfk.com/javascript/…