I want to achieve this format. As you can see on the output there's a bracket but I want to get only the '10': ["11/21/2022", "11/25/2022"] or this one.
{
'10': ["11/21/2022", "11/25/2022"]
}
const data = [{
user_id: "10",
dates: ["11/21/2022", "11/25/2022"],
}, ];
const output = data.map(({
user_id,
dates
}) => ({
[user_id]: dates
}));
console.log(output);
let out = {}; for (let item of data) out[item.user_id] = item.dates; console.log(out)output[0]?