title: Creating some associative array in JavaScript
body: <p>I have an object which contains an array, and I want it to contain an associative array so keys are strings. How can I do it?</p>
  <p>This does not work:</p>
  <pre><code>{profiles: { easy:[&quot;example&quot; : 1], advanced:[&quot;example&quot; : 1] }
  </code></pre>
  <p>I wanted to avoid</p>
  <pre><code>console.log({profiles: { easy: {&quot;example&quot;: 1}, advanced:{&quot;example&quot;: 1} })
  </code></pre>
  <p>Because that <em>easy</em> and <em>advanced</em> members are not displayed as an array but as an object.</p>
  <p>Another way I know is this:</p>
  <pre><code>array['key2'] = 'new value';
  </code></pre>
  <p>but that is not part of the object, so I would need to split the command for multiple lines - which is not what I want.</p>
  <p>PHP has something like array(&quot;mykey&quot; =&gt; &quot;myValue&quot;), but does JavaScript have something similar?</p>
  <p>Yet I don't want to use frameworks. This is JavaScript only.</p>