Create an array of hashes in javascript
<p>I want to create an array of hashes in javascript. In other words, I want to do the following thing</p>

<pre><code> var messages = new Array;
 messages['info'].push(["info message1", "info message2", "info message3"]);  
 messages['error'].push(["error message1", "error message2", "error message3"]); 
</code></pre>

<p>and then iterate through each key. But it gives me an error <code>"Cannot call method 'push' of undefined"</code></p>

<p>How can I do it?</p>
