I have an array like this:
[
[
1, 2, 3, 4,
5, 6, 7
],
[
{ Id: 42258 },
{ Id: 42259 },
{ Id: 42260 },
{ Id: 42261 },
{ Id: 42262 },
{ Id: 42263 },
{ Id: 42264 },
{ Id: 42265 },
{ Id: 42266 },
],
[
{ Address_GetListCurrentResult: 'street1' },
{ Address_GetListCurrentResult: 'street2' },
{ Address_GetListCurrentResult: 'street3' },
{ Address_GetListCurrentResult: 'street4' },
{ Address_GetListCurrentResult: 'street5' },
{ Address_GetListCurrentResult: 'street6' },
{ Address_GetListCurrentResult:' street7' },
{ Address_GetListCurrentResult: 'street8' },
{ Address_GetListCurrentResult: 'street9' }
],
[
{ PersonalInfo_GetCurrentResult: 'info1' },
{ PersonalInfo_GetCurrentResult: 'info2' },
{ PersonalInfo_GetCurrentResult: 'info3' },
{ PersonalInfo_GetCurrentResult: 'info4' },
{ PersonalInfo_GetCurrentResult: 'info5' },
{ PersonalInfo_GetCurrentResult: 'info6' },
{ PersonalInfo_GetCurrentResult: 'info7' },
{ PersonalInfo_GetCurrentResult: 'info8' },
{ PersonalInfo_GetCurrentResult: 'info9' }
]
]
how do i get all the objects at the same index in the nested arrays and get them into a new one with the index being dynamic.
Already tried to iterate with for and forEach but never goes into all of them, a code example of what i have right now
nmbrsEmployee = [
[
1, 2, 3, 4,
5, 6, 7
],
[
{ Id: 42258 },
{ Id: 42259 },
{ Id: 42260 },
{ Id: 42261 },
{ Id: 42262 },
{ Id: 42263 },
{ Id: 42264 },
{ Id: 42265 },
{ Id: 42266 },
],
[
{ Address_GetListCurrentResult: 'street1' },
{ Address_GetListCurrentResult: 'street2' },
{ Address_GetListCurrentResult: 'street3' },
{ Address_GetListCurrentResult: 'street4' },
{ Address_GetListCurrentResult: 'street5' },
{ Address_GetListCurrentResult: 'street6' },
{ Address_GetListCurrentResult:' street7' },
{ Address_GetListCurrentResult: 'street8' },
{ Address_GetListCurrentResult: 'street9' }
],
[
{ PersonalInfo_GetCurrentResult: 'info1' },
{ PersonalInfo_GetCurrentResult: 'info2' },
{ PersonalInfo_GetCurrentResult: 'info3' },
{ PersonalInfo_GetCurrentResult: 'info4' },
{ PersonalInfo_GetCurrentResult: 'info5' },
{ PersonalInfo_GetCurrentResult: 'info6' },
{ PersonalInfo_GetCurrentResult: 'info7' },
{ PersonalInfo_GetCurrentResult: 'info8' },
{ PersonalInfo_GetCurrentResult: 'info9' }
]
]
let objectsAtPosition = []
function testArray() {
for (let i = 0; i < nmbrsEmployee.length; i++) {
const subArray = nmbrsEmployee[i];
const objectAtIndex = subArray[1];
objectsAtPosition.push(objectAtIndex);
console.log('objectsAtPosition', objectsAtPosition);
}
}
Thank you for the help in advance