var movies = [{
title: "Mission Impossible 2",
year: 2000,
rating: 5,
genre: ["Action"]
}, {
title: "The Mummy",
year: 1999,
rating: 6,
genre: ["Action", "Comedy"]
}]
var list = "Action"
console.log(movies.filter(function (movie) {
return isInSet(list, movie);
}))
console.log(movies.filter(isInSet.bind(null, list)))
function isInSet(set, item) {
return set.indexOf(item.genre) > -1;
}
This returns with mission impossible
Now what I would like to do is change list to
var list = ["Action", "Comedy"]
but when I do it returns with an empty array, Can anyone help explain how to search the array of genre with the array list; to return The Mummy?
Thanks in advance