Tell us what’s happening:
Your code so far
function whatIsInAName(collection, source) {
for(let key in source){
// console.log(source)
for(let k in collection){
// console.log(collection[k])
if(collection[k].hasOwnProperty(key) && source[key] == collection[k][key]){
return collection[k];
}
}
}
}
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: