function whatIsInAName(collection, source) {
// What's in a name?
var arr = [];
var sourceProp = Object.getOwnPropertyNames(source);
for(var j = 0; j < sourceProp.length; j++){
for(var i = 0; i < collection.length; i++){
if(collection[i].hasOwnProperty(sourceProp[j]) && collection[i][sourceProp[j]] == source[sourceProp[j]]){
}
arr.push(collection[i]);
}
}
}
whatIsInAName([{ "a": 1, "b": 2 }, { "a": 1 }, { "a": 1, "b": 2, "c": 2 }], { "a": 1, "b": 2 });
I feel like I am getting close to the answer. I cant seem to pass the last two tests for this challenge. I would really appreciate any tips or steps to the right direction. Thank you in advance.