I currently have an array of arrays that looks like the following:
const writeable = [
[{id: 1, name: "item1", write: true}],
[{id: 3, name: "item3", write: true}]
]
I would like to convert the array of arrays (all of which contain a single object) to an array of objects.
I have tried mapping through the writeable array and pushing each item into a new array, but because .map returns a new array, I'm left with the same result. Is there a way to do this, or is this not possible?
The expected output:
const newArray = [
{id: 1, name: "item1", write: true},
{id: 3, name: "item3", write: true}
]
.flatMapinstead of.map. Or justwriteable.flat():-)[].concat(...writeable)