Tell us what’s happening:
I can only pass 3 of 4 tests
Your code so far
function whatIsInAName(collection, source) {
var sourceKeys = Object.keys(source);
var result = [];
var noOfMatchingProperties = 0;
collection.forEach(function(element, index){
noOfMatchingProperties = 0;
for(var i = 0; i < sourceKeys.length; i++){
if(element.hasOwnProperty(sourceKeys[i])){
noOfMatchingProperties++;
}
}
if(noOfMatchingProperties === sourceKeys.length){
result.push(element);
}
});
return result;
}
Your browser information:
Chrome/65.0.3325.181
Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36
.
Link to the challenge:
https://www.freecodecamp.org/challenges/wherefore-art-thou