I'm struggling with how to add the element of the array into an array of objects. I have an array of object:
0: (20) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]
1: (20) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]
2: (20) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]
...etc
And I have an array that contains strings:
const titles = ["some title A", "some title B", "some title C"]
So my purpose is, I want to make my data like this:
[
{results: my_existing_array_of_object, title: "some title A"},
{results: my_existing_array_of_object, title: "some title B"},
{results: my_existing_array_of_object, title: "some title C"},
]
How to do that? Thanks in advance
titles.map((title) => ({results: resultsArray, title}));?