Tell us what’s happening:
Describe your issue in detail here.
is this a good way to solve this alogorithm that way ??
**Your code so far**
function whatIsInAName(collection, source) {
for(let i =0; i < Object.keys(source).length;i++){
collection = collection.filter(item => item[Object.keys(source)[i]] == Object.values(source)[i]);
}
return collection;
}
whatIsInAName([{ "apple": 1, "bat": 2 }, { "apple": 1 }, { "apple": 1, "bat": 2, "cookie": 2 }, { "bat":2 }], { "apple": 1, "bat": 2 })
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36
Challenge: Intermediate Algorithm Scripting - Wherefore art thou
Link to the challenge: