3.1 数组是什么

  1. 数组:它是一个有序的集合 <br /> 获取数组中的某个值 数组的下标从 0开始<br />![image.png](https://cdn.nlark.com/yuque/0/2021/png/21644472/1622797141136-eb7b0bb1-cf04-4056-a403-6c3e5a7cfa35.png#clientId=u39d8c720-b6b0-4&from=paste&height=216&id=ud54042af&margin=%5Bobject%20Object%5D&name=image.png&originHeight=216&originWidth=1087&originalType=binary&size=69042&status=done&style=none&taskId=u06ec5e12-af79-4788-b613-66dcb65234f&width=1087)

3.2 如何获取数组的长度—> length

  1. var arr =[1,2,3];
  2. console.log(arr.length);

image.png

3.3 获取数组的最后一位值—>arr.length-1

  1. var arr =[1,2,3,5,6];
  2. console.log(arr[arr.length-1]);

image.png