const array1 = ['US', 'AG','In'] // (country code array)
const array2 = ['flagIconUS','flagIconAG','flagIconIN']
Result :
const array3 = [
{ code: "US", icon: "flagIconUS" },
{ code: "AG", icon: "flagIconAG" },
{ code: "IN", icon: "flagIconIN" },
];
indexin the two arrays? I mean in the same order?Object.entriesetc.forloop would be enough to get the expected output...