How do the map function that return an object with modified keys? (JS, React.js)

I am trying to create an object with modified keys after map() function (the data is from API), here is my code:

    const getData = => ({
      []: false,

This code return:

enter image description here

And I want this output:

enter image description here

Do you have any solution for this case? thank you.



  1. Create an object => const getData = {};
  2. Iterate => mySchedule.schedules
  3. Set id as a key and false as value => getData[] = false;
const getData = {};

mySchedule.schedules.forEach(item => {
   getData[] = false;