var disciplines = {
"Arts and culture": ["design", "culture", "literature", "cinema and television", "theatre", "music","painting", "dance"],
"History and Philosophy": ["history", "archeology", "religion", "philosophy"]
};
function mySample(s) {
var res1 = searchInKey(s, disciplines);
if (res1) {
return res1
}
for (key in disciplines){
if(disciplines[key].indexOf(s.toLowerCase()) >= 0){
return key;
}
}
return "Not found"
}
// дополнительный поиск
function searchInKey(s, arr) {
for (key in arr){
if(s.indexOf(key.toLowerCase()) >= 0){
return key;
}
}
}
console.log(mySample("Human Arts and Culture")); // Ответ: Arts and culture