Features of the array type:
- is an ordered list of data
- Can save any type of data
- Array size can be dynamically adjusted
- The creation of an array object can be using the constructor method var arr = new Array (); You can also use the array literal method var arr = [];, as with the array literal method and the object literal method, no longer call the corresponding constructor
- Note: When creating an array, do not add a comma after the last item, otherwise a value of undefined will be more than one in IE8 and earlier versions than in other browsers
- The length property of an array can not only get the array lengths but also set the array length, if the length of the set is greater than the original number length, then the value of the new item is undefined
Array Detection:
- Using instanceof to detect, this method is limited to a single global execution environment
- For passing an array from one frame to another, with instanceof, the ECMAScript 5 new Array.isarray () method can ultimately determine whether a value is an array, regardless of which global execution environment it is created in. Browsers that support this method have ie9+,firefox4+,safari5+,opera10.5+ and chrome to accurately detect arrays in browsers that do not support this method.
Conversion method:
- All objects have the ToString ()/valueof ()/tolocalestring () method
- The ToString () and valueof () methods of the array return the same value and return a comma-delimited string represented by the string of each item in the array; the ToString () method of each item of the array is called when the string is created
- The direct alert () array implicitly calls the ToString () method of the array
- The array's tolocalestring () also invokes the toLocaleString () method of each item of the array, and sometimes its results differ from ToString () and valueof (), as in the case of:
- All three of these methods are string representations of array items separated by commas, and the join () method allows you to define delimiters, such as join ("-"), and the resulting string is a-join, or a comma-delimited if you do not pass in a parameter or pass in undefined. However, in IE7 and earlier versions, it is wrong to use undefined as the delimiter.
- If the value of an item in the array is null or undefined, the value is represented as an empty string in the result returned by join ()/tostring ()/tolocalestring ()/valueof ().
Fifth. Reference type-note 2 (with left question, answer in Chapter 22, section 1.1)