I have an array of array containg informations about the employe of a company. The array look like this
[
[
"14578",==> employee number
"Marc", ==> employee name
"Paris",==> employee city
"ENGINEER",==> employee position
"24578963", ==> employee salary
"A" ==> employee team
],
[
"81832",
"Alan",
"Marseille",
"MECHANIC",
"25578963",
"C"
],
[
"39629",
"John",
"Lyon",
"PLUMBER",
"26578963",
"F"
]
]
And i want to each array , to get the first information (employee number ) and the fourth information (employee position)
desired output
[{"employee number": "14578","employee position": "ENGINEER"}, {"employee number": "81832","employee position": "MECHANIC"}, {"employee number": "39629","employee position": "PLUMBER"}]
I use map like this :
const myExtractArray = myInitialArray.map( elt =>
{
"employee number" : elt[0],
"employee number":elt[3]
return elt
}
);
But i doesn't get the desired output. How can i do this please ?