array to map with reduce()

let months = [
  {month: 1, data1: "test1", data2: "test2"},
  {month: 2, data1: "test1", data2: "test2"},
  {month: 3, data1: "test1", data2: "test2"}
];
 
let monthsAsMap = months.reduce((map, obj) => {
  map[obj.month] = obj;
  return map;
}, {});
 
console.log(monthsAsMap);
console.log(monthsAsMap['2']);
Results
{ 
  '1': { month: 1, data1: 'test1', data2: 'test2' },
  '2': { month: 2, data1: 'test1', data2: 'test2' },
  '3': { month: 3, data1: 'test1', data2: 'test2' } 
}
{ month: 2, data1: 'test1', data2: 'test2' }