1. How to create an array:
- Use the array constructor:
var colors=new Array ()var colors=New Array (+)// L Create an array of 20 items var colors=New Array ("Red", "Blue", "green")// Create an array with 3 strings
2. Use the array literal to indicate:
var colors=["Red", "Blue", "green"]// Create an array with 3 strings var names=[]// Create an empty array var values=[1,3,]// do not create an array with 2 items/3 items var options=[,,,,,]/ / Don't do this, create an array containing 5 items/6 items
2. The length property of the array: more than just readable, by setting this property, you can remove an item from the end of the array or add an item to the array.
3. Detecting Arrays:
For a single Web page, a global scope uses instance Of:if (value instanceof Array) {To perform certain operations on the array), and if the page contains more than one frame, there are actually more than two different global execution environments. Thus there are more than two different versions of the array constructor, using the Array.isarray () method of the ECMAScript 5 function, which supports the following browsers: Ie9+,firefox 4+,safari 5+,chrome, and so on.
JavaScript Advanced Programming 5th Chapter Object Type---Array---learning experience