title: Javascript: Varying width multi dimension array
body: <p>I want to create a 2D array, with varying width. I have initialized the outer array as I know the number of rows.</p>
  
  <pre><code>var listofcities = new Array(lengthofcites); //i get this lengthofcitles from another routine
  </code></pre>
  
  <p>Now, I will get the list of facilities in the cities from another routine as list. E.g. <code>listoffacilities = ["water","air"]</code> for a city. For another city I will get this list as <code>listoffacilities = ["water","air","electricity"]</code>.</p>
  
  <p>I should be able to store this in my outer array in such a way that </p>
  
  <pre><code>listofcities[0] = ["water","air"]
  listofcities[1] = ["water","air","electricity"]
  </code></pre>
  
  <p>I'm not able to use the push function like <code>listofcities[0].push(listoffacilities)</code> in the inner loop.</p>
  
  <p>All the examples I could see from web have same sized rows/columns.</p>