I am faced with the challenge of merging two arrays and converting them into objects stored in one array.
const name = ["Amy", "Robert", "Sofie"];
const age = ["21", "28", "25"];
The desired output:
const person =[{name: 'Amy', age: '21'}, {name: 'Robert', age: '28'}, {name: 'Sofie', age: '25'}];
I am looking for a way to automate this process as my array is lengthy, making it inconvenient to type manually. Your help is appreciated. Thank you.