title: Array of objects with custom keys
body: <p>I have an array of strings with vehicle names.</p>
  
  <pre><code>a=['car', 'scooter', 'bike'];
  </code></pre>
  
  <p>I need to generate a array such that each object would have a property <code>color:red</code> in it</p>
  
  <p>I used <code>array.reduce</code> for it. This is the code i have written </p>
  
  <pre><code>function getInitialMap(a) {
      const vehicleMap = [];
      return vehicles.reduce((_vehicleMap, type) =&gt; {
          _vehicleMap.concat({[type]: {color: red}});
          return _vehicleMap;
      }, vehicleMap);
  }
  </code></pre>
  
  <p>what I got is:</p>
  
  <pre><code>_vehicleMap = [
      0:{car:{color:red}},
      1:{scooter:{color:red}},
      2:{bike:{color:red}}
  ]
  </code></pre>
  
  <p>what I required: </p>
  
  <pre><code>_vehicleMap = [
      car:{color:red},
      scooter:{color:red},
      bike:{color:red},
  ]
  </code></pre>
  
  <p>Can someone help in generating array with custom keys here</p>