I have several objects that look like this when i console.log them:
0: { 'school': {}, 'district': {}, 'children': {} }
1: { 'school': {}, 'district': {}, 'children': {} }
2: { 'school': {}, 'district': {}, 'children': {} }
and
0: { 'teacher': {}, 'name': {}, 'class': {} }
1: { 'teacher': {}, 'name': {}, 'class': {} }
I am looking to combine these objects so that they become like:
0: { 'school': {}, 'district': {}, 'children': {} }
1: { 'school': {}, 'district': {}, 'children': {} }
2: { 'school': {}, 'district': {}, 'children': {} }
3: { 'teacher': {}, 'name': {}, 'class': {} }
4: { 'teacher': {}, 'name': {}, 'class': {} }
But when I use something like Object.assign the last object will just overwrite the previous one, is there another method to do this? I basically just want to merge several objects, and ignore their indexes.
const foo = [...Object.values(obj1), ...Object.values(obj2)]