JSFiddle - React, Tailwind, and code Playground
by Alex Azuero
JavaScript
var countrylist = [{ "Country": "United States", "Code": "us" }, { "Country": "Belgium", "Code": "be" }, {"Country": "Argentina", "Code": "ar" }],
citylist = [{ "City": "Abernant", "Code": "us", "CityId":1},{ "City": "Academy Park", "Code": "be", "CityId": 2},{ "City": "Abernathy", "Code": "ar","CityId":3 }],
newArray = [];
$.each(citylist, function(idx,val){
var code = val.Code;
$.each(countrylist,function(x,valu){
if(valu.Code === code){
newArray.push($.extend({},valu,val));
}
});
});
console.log(newArray);