下面列出的国家/地区清单是我们应该完成的功能,该功能将输入作为国家/地区名称并将输出作为逗号分隔,并发送该特定国家/地区中所有州的firstLetter值
样本输入-findCountryFunction(“ France”)输出-“ N,O,P,P”
let countryData = {
"France": ["Nouvelle-Aquitaine",
"Occitanie",
"Pays de la Loire",
"Provence-Alpes-Côte d'Azur"
],
"India": ["West Bengal",
"Andhrapradesh",
"Hariyana"
],
"Bangladesh": ["Dhaka",
"Khulna",
"Barishal"
]
};
let findCountryFunction = (stateName)=>{
for(let info in countryData){
if(countryData[info] == stateName){
console.log(countryData[info][0]);
}
}
};
findCountryFunction("France");
ABOUTYOU
跃然一笑
相关分类