What is an array it? Array is worth an ordered set . Each value is called an element, and each element has a location in the array, expressed as a number, called an index.
In JavaScript array has the following characteristics:
- Untyped array elements which may be of any type. (May even be an array of arrays of objects or arrays of other arrays, array ..........................................)
- The first element is indexed: 0, last element index is: 4294967294.
- Dynamic: the need to increase or reduce the array based on, so when you create an array of size would not declare a fixed-length.
- It may be discontinuous (sparse): space in the array may be vacant.
How to create an array of it?
- An array of direct amount
var array=[1,"a","叶",true,1.1];
- Calling Array constructor:
var a=new Array();//创建一个空数组
var b=new Array(10);//创建一个长度为10的数组
var c=new Array(1,"a","叶",true,1.1);//创建一个存放这些元素数组
Read array
var a=["codemax"];//写入第一个元素
alert(a[0]);//读取第一个元素,数组下标为0
a[1]=66666666;//写入第二个元素,很6
var i=2;//下面几句代码输出的结果是?
a[i]=3;
a[i+1]="Hello World !";
alert(a[a[i]]);
Deepen the understanding of the array of knowledge through the following points
- In fact, the array is a special form of objects.
- Sparse array
- Length of the array
- Add and delete arrays
- Iterate
- Multidimensional Arrays
- An array of methods
- Method of array ECMAScript5
- Array type
- Class array of objects
- As the array of strings
References - "JavaScript The Definitive Guide"