0
我在我的演示应用程序中有两个数组。数组一个有内容的国家另一个是列表国家。所以,如果该国家不包含在国家阵列中,我想从国家阵列中移除国家。我已经把我下面的数组值,如何从Javascript中的另一个数组值中过滤数组值?
var continent = [
{
"continent":"Europe",
"country":["Albania", "Andorra", "UK", "Ireland"]
},
{
"continent":"Asia",
"country":["Armenia", "Cambodia", "China", "Cyprus"]
}
]
var selectedCountries = ["Albania", "Andorra", "Armenia"];
输出
var result = [
{
"continent":"Europe",
"country":["Albania", "Andorra"]
},
{
"continent":"Asia",
"country":["Armenia"]
}
]
[供-每遍在JavaScript的阵列?](可能的复制http://stackoverflow.com/questions/9329446/for-each-over-an-array -in的JavaScript) – nyedidikeke