You may be confusing Javascript arrays with PHP arrays. In PHP, arrays are very flexible. They can either be numerically indexed or associative, or even mixed.
array('Item 1', 'Item 2', 'Items 3') // numerically indexed array
array('first' => 'Item 1', 'second' => 'Item 2') // associative array
array('first' => 'Item 1', 'Item 2', 'third' => 'Item 3')
Other languages consider these two to be different things, Javascript being among them. An array in Javascript is always numerically indexed:
['Item 1', 'Item 2', 'Item 3'] // array (numerically indexed)
An "associative array", also called Hash or Map, technically an Object in Javascript*, works like this:
{ first : 'Item 1', second : 'Item 2' } // object (a.k.a. "associative array")
They're not interchangeable. If you need "array keys", you need to use an object. If you don't, you make an array.
*
Technically everything is an Object in Javascript, please put that aside for this argument. ;)