Why can’t i use the && operator here if we are checking if the object in the collection doesn’t have the key (and) the property value doesn’t match the value in source.
**Your code so far**
function whatIsInAName(collection, source) {
const sourceKeys = Object.keys(source)
return collection.filter(function(obj){
for (let i = 0; i < sourceKeys.length; i++){
if (!obj.hasOwnProperty(sourceKeys[i])|| obj[sourceKeys[i]] !== source[sourceKeys[i]]){
return false;
}
}
return true
})
}
whatIsInAName([{ first: "Romeo", last: "Montague" }, { first: "Mercutio", last: null }, { first: "Tybalt", last: "Capulet" }], { last: "Capulet" });
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0
Challenge: Wherefore art thou
Link to the challenge: