Stuck on Where Art Thou challenge

Tell us what’s happening:

Hi. I managed to return a filtered collection array that has one or more same properties, and I’m stuck about how to compare values between object(s) of filtered one and source one.

And I have a feeling that I’m making it unnecessarily complicated.

Any help would be appreciated. Thank you!

Your code so far


function whatIsInAName(collection, source) {
var arr = [];
// Only change code below this line
    let filtered = collection.filter(obj => {
      let arr = [];
      const srcKeys = Object.keys(source);
      for (let i=0; i<srcKeys.length; i++) {
        arr.push(obj.hasOwnProperty(srcKeys[i]));
      }  
      return arr.every(Boolean);
    });

// Only change code above this line
return arr;
}

whatIsInAName([{ first: "Romeo", last: "Montague" }, { first: "Mercutio", last: null }, { first: "Tybalt", last: "Capulet" }], { last: "Capulet" });

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36.

Challenge: Wherefore art thou

Link to the challenge: