📅  最后修改于: 2022-03-11 15:02:10.995000             🧑  作者: Mango
let shops = [
{
name: 'shop1',
tags: ['s', 'd', 'f'],
country: 'rda'
},
{
name: 'shop2',
tags: ['e', 'd', 'r'],
country: 'ke'
},
{
name: 'shop3',
tags: ['p', 'u', 'i'],
country: 'rda'
},
{
name: 'shop4',
tags: ['a', 'k', 'l'],
country: 'bu'
}
]
function getRdaShops(){
retun shops.map(sh=>{
if(sh.name && sh.country==='rda') return sh.name
}).filter(sh=>sh!==undefined)
}
//Answer: ['shop1', 'shop3']