

Understanding JavaScript Arrays - heseltine
http://javascriptweblog.wordpress.com/2010/07/12/understanding-javascript-arrays/

======
svnv
Isn't this faster for iterating over the elements:

    
    
      var a = ["banana", Math.min, 4, "apple"];
      for (var i=a.length; i; i--) {
        console.log(a[i]);
      }

~~~
svnv
Actually, I just realized this does not work, there is an off by 1 error here.
jacksoncarter's piece of code works though.

------
ccollins
I want to stress that the following will work, but get you in trouble.
Javascript does not support associative arrays.

    
    
      var myData = new Array;
    
      myData['key1'] = 'value1';
      myData['key2'] = 'value2';
      myData['key3'] = 'value3';
    
      myData.length; //0

~~~
olavk
I would say that JS does support associative arrays, since it is the
fundamental data type behind objects and arrays. Arrays are basically
associative arrays, since the index is converted into a string and used as a
key. E.g. myData[7] is equivalent to myData["7"].

The length property does not return the number of items in the array though.
It returns the value of the key with the highest numerical value if parsed as
a integer plus one.

~~~
robryan
Also you can use associate array notation to access an object property. Found
this out after previously using eval to access a dynamic property name.

~~~
code_duck
yes, that's right - item.akey is interchangeable with item['akey'], but the
latter form accepts expressions as the key value.

------
messel
forEach,map, and several other ECMA5 methods look like a joy to use

------
msie
This isn't your father's Array. Sigh.

