For example, I have two arrays like these.
const dateArray = ['January', 'February', 'March', 'April', 'May', 'June']
const InfoArray = [
  { Date : '2022-01', Active: 1 },
  { Date : '2022-02', Active: 12 },
  { Date : '2022-03', Active: 25 },
  { Date : '2022-04', Active: 33 },
  { Date : '2022-05', Active: 120 },
  { Date : '2022-06', Active: 335 },
]
However, I want combined these two arrays into an array of objects.
const result = [
  { month: 'January', Active: 1 },
  { month: 'February', Active: 12 },
  { month: 'March', Active: 25 },
  { month: 'April', Active: 33 },
  { month: 'May', Active: 120 },
  { month: 'June', Active: 335 },
]
I looked for some information, and did like
  const makeObjectWithTwoArray = () => {
    let chartObj = {}
    dateArray.forEach((element, index) => {
      chartObj[element] = infoArray[index]
    })
    return chartObj
  }
however doesn't work at all. (of course because each array can't have same keys with the code.)
Your help will be much appreciated.


.reduceor uselodash.unionBy. stackoverflow.com/a/39127782/6877699.map()since the array lenght isn't changing.mapworks :)