How to initialize arrays in ES6/ES2015?
<p>Is there a way to skip array initialization in ES6 ? I have to enumerate below R twice, first to initialize counters, then to do actual count of A elements. I would rather do one enumeration</p>

<pre><code>var A = ['red',1,'blue','red',1];   // test data

    var R = []; //associative array keeping count of A values

    A.map((item)=&gt; R[item]=0); //initialize R with A elements as R indexes
    A.map((item)=&gt; R[item]++); //count repeated A elelemnts in R
</code></pre>