Array "(Array), and" Object "(Object) may be used to represent both a collection of data.
For example there is an array a = [1,2,3,4], as well as an object a = {0: 1,1: 2,2: 3,3: 4}, and you run alert (a [1]) , the results in both cases are the same!
It represents a collection of ordered arrays of data, and the object represents a collection of unordered data. If the order of the data is important to use the array, otherwise with the object.
1. In JavaScript, create a method with an array of different objects are as follows:
2. The array has a length, the length of the object is not:
3. Call methods are also different, namely:
4. The target value is unique, the array may be repeated:
5. Both can be traversed by for in (a detailed look at the essay traversal)