Javascript 中的 constructor函数

首页 / JavaScript入门教程 / Javascript 中的 constructor函数

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

constructor - 语法

array.constructor

constructor - 返回值

返回创建此对象的函数。

无涯教程网

链接:https://www.learnfk.comhttps://www.learnfk.com/javascript/array-constructor.html

来源:LearnFk无涯教程网

constructor - 示例

<html>
   <head>
      <title>JavaScript Array constructor Property</title>
   </head>
   
   <body>
   
      <script type="text/javascript">
        var arr=new Array( 10, 20, 30 );
        document.write("arr.constructor is:" + arr.constructor); 
      </script>
      
   </body>
</html>

运行上面代码输出

arr.constructor is: function Array() { [native code] } 

祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)

技术教程推荐

赵成的运维体系管理课 -〔赵成〕

微服务架构核心20讲 -〔杨波〕

TensorFlow快速入门与实战 -〔彭靖田〕

高并发系统设计40问 -〔唐扬〕

苏杰的产品创新课 -〔苏杰〕

自动化测试高手课 -〔柳胜〕

React Native 新架构实战课 -〔蒋宏伟〕

中间件核心技术与实战 -〔丁威〕

结构思考力 · 透过结构看表达 -〔李忠秋〕

好记忆不如烂笔头。留下您的足迹吧 :)