I have two objects with a similar structure -
var locations = {
"regions": [{
"name": "Asia Pacific",
"handle": "asia-pacific",
"iso_code": "",
"iso_code_3": "",
"countries": [{
"name": "Republic of Korea",
"iso_code": "kr",
"iso_code_3": "kor"
},{
"name": "Japan",
"iso_code": "jp",
"iso_code_3": "jap"
}
]
}]
}
var additionalLocations = {
"regions": [{
"name": "Asia Pacific",
"handle": "asia-pacific",
"iso_code": "",
"iso_code_3": "",
"countries": [{
"name": "Malaysia",
"iso_code": "my",
"iso_code_3": "mys",
}
]
}]
}
How can I the country, Malaysia, from the additionalLocations object to the locations object?
It should look like this -
var locations = {
"regions": [{
"name": "Asia Pacific",
"handle": "asia-pacific",
"iso_code": "",
"iso_code_3": "",
"countries": [{
"name": "Republic of Korea",
"iso_code": "kr",
"iso_code_3": "kor"
},{
"name": "Japan",
"iso_code": "jp",
"iso_code_3": "jap"
},{
"name": "Malaysia",
"iso_code": "my",
"iso_code_3": "mys",
}
]
}]
}
I'm hoping there's a nifty underscore method that will do it for me.