I realize that right now this code doesn’t work. I’ve spent awhile on this and feel pretty lost…
function whatIsInAName(collection, source) {
for(i = 0; i < collection.length; i++) {
if(Object.keys(collection[i]) && Object.values(collection[i]) === Object.values(source)) {
return collection[i];
}
}
}
whatIsInAName(
[{ first: "Romeo", last: "Montague" },
{ first: "Mercutio", last: null },
{ first: "Tybalt", last: "Capulet" }],
{ last: "Montague" });