Home  >  Q&A  >  body text

关于定义数组不是很理解

<!DOCTYPE HTML>
<html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 <title>php.cn</title>
 <script> 
 //使用[]方式创建一个数组
 var arr = new Array("张三","男",25,"安徽"); 
 document.write(arr); 
 </script>
 </head>
 <body>
 </body>
</html>

这里Array()有什么用 后面并没有用到这个啊


phpcn_u224phpcn_u2242864 days ago1127

reply all(2)I'll reply

  • 数据分析师

    数据分析师2017-09-30 22:44:21

    I don’t quite understand about defining arrays-PHP Chinese website Q&A-I don’t quite understand about defining arrays-PHP Chinese website Q&A

    Take a look around and learn.

    reply
    0
  • 阿神

    阿神2016-12-17 13:36:39

    Array 是js中的数组对象

    new Array();这一句是确定arr的类型为数组类型,并在内存中开辟一个空间存储这个新建的对象。

    就相当于你在商场申请了个储物柜,储物柜名称是arr,new Array();就是你申请的那个储物柜,有人帮你存取东西你告诉他储物柜名字是那个就行了;如arr[0]=80;

    reply
    0
  • Cancelreply