I have two arrays in my demo application. Array one has countries with content another one is list countries. So, i want to remove countries from array one, if that country not contained in country array. I have put my array values below,
var continent = [
{
"continent":"Europe",
"country":["Albania", "Andorra", "UK", "Ireland"]
},
{
"continent":"Asia",
"country":["Armenia", "Cambodia", "China", "Cyprus"]
}
]
var selectedCountries = ["Albania", "Andorra", "Armenia"];
The output
var result = [
{
"continent":"Europe",
"country":["Albania", "Andorra"]
},
{
"continent":"Asia",
"country":["Armenia"]
}
]