In JavaScript, array is also an object, but some people may mistakenly think that access like a ['key'] is an array function, not actually.
In the following example, after an array value is assigned, its Length attribute is still 0, because the data is not placed in the array position, but in the original object of the array.
VaR A = new array (); A ['one'] = 1; A ['two'] = 2; A ['three '] = 3; alert (. length );
Another key point:
When instantiating an object in Javascript, you can create an object in the form of {key: Value. The key can be a direct or string. In the following example, the content of A1 and A2 is exactly the same.
Note that var1 of A1 or A2 will not be changed to 'ps '.
VaR var1 = 'pm '; var a1 = {var1: 'test is OK', var2: 'where'}; alert (a1.var1 );VaR a2 = {var1: 'test is OK ', 'var2': 'where '};Alert (a2.var1 );