Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
Javascript - convert array of arrays into array of objects with prefilled values
(4 answers)
Closed
2 years ago
.
–
var a=[ [ 'James', 23, 'male' ], [ 'Britney',45,'female']];
var result = a.map(([name,age,gender])=>({name, age, gender}));
console.log(result);