I'm trying to remove the indexes of an array in the easiest and most efficient possible way. This is the array like:
Having this array (see snipet):
let arr = [];
arr.push([{id:1}]);
arr.push([{id:2}, {id: 3}]);
arr.push([{id:4}]);
console.log(arr)
the expected result is an array that joins all the objects into one same index.
[
{id: 1},
{id: 2},
{id: 3},
{id: 4}
]
If I iterate every element on the array and add every object to a new array I can get the result I'm expecting but there must be a function or something that simplifies de code..
Thanks in advance