Hello everyone!
could someone help me understand why this option does not work? it makes sense in my head…
I have also tried replacing includes with hasOwnProperty() but the outcome is the same
(collection[i].hasOwnProperty(source))
function whatIsInAName(collection, source) {
var arr = [];
// Only change code below this line
for (let i=0; i<collection.length;i++)
{if (collection[i].includes(source))
{arr.push(collection[i])}
}
// Only change code above this line
return arr;
}
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; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36
.
Challenge: Wherefore art thou
Link to the challenge: