Yes but you didn’t check whether the values are same or nah (you need to check the values too to pass the test).
Also you might miss this clue.
Make a function that looks through an array of objects (first argument) and returns an array of all objects that have matching name and value pairs (second argument).
Notice that the second argument is key value pairs therefore not an Array but an Object. So you don’t have to loop the source.
Here’s your code without the source loop.
function whatIsInAName(collection, source) {
var arr = [];
// Only change code below this line
for (let i = 0; i < collection.length; i++) {
if (collection[i].hasOwnProperty(Object.keys(source))) {
{ arr.push(collection[i]); }
}
}
// Only change code above this line
return arr;
}