Hey there! Can you help me figure out how to iterate over an array using values from an object as filters?
const hotels = [
{
name: "Marina Inn",
country: "USA",
address: "Faliraki",
stars: 4,
},
{
name: "Mondrian Suites",
country: "Greece",
address: "Rhodes",
stars: 5,
},
{
name: "Mondrian Suites",
country: "USA",
address: "Rhodes",
stars: 5,
}
]
I need to filter these objects based on the following criteria stored in an object:
const objFilter = {
country: "USA",
stars: 5,
}
The expected result should be an array as shown below
[
{
name: "Mondrian Suites",
country: "USA",
address: "Rhodes",
stars: 5,
}
]