understanding nested arrays in Javascript
问题 I want to create a nested array in Javascript but can't do the thing what I want, I don't know if it is even possible. Here is an example of what kind of array I want to create: var array = ['id1', 'id2', 'id3', 'id4']; Then I want to add new array for each id such way that id values stayed the same. Why? because I want to use indexOf method to find out the element index of main array with sub array id. Something like this: array[0]['par1'] should return the value of parameter1 array[0]['par2