I have this code below consisting of 2 arrays with key pair values. What i'm currently trying to achieve is to combine this arrays into something like this.
[{"id" : "1" , "alphabet" : "A"}, {"id" : "2" , "alphabet" : "B"}, {"id" : "3" , "alphabet" : "C"}, ]
Is there any easy way to achieve this? Any help would be greatly appreciated thank you.
var arr = [1,2,3,4,5,6,7,8,9]
var array = arr.map((x) => ({ id:x }));
console.log(array);
var arr2 = ['A','B','C','D','E','F','G','H','I']
var array2 = arr2.map((x) => ({ alphabet:x }));
console.log(array2);