Tell us what’s happening:
Your code so far
function whatIsInAName(collection, source) {
let src = Object.keys(source)
return collection.filter((el) => src.map((k) => el.hasOwnProperty(k) && el[k]=== source[k])).reduce((a, b) => a && b);
}
console.log(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) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36.
Link to the challenge: