Need guidance with (Wherefore art thou)

I dont understand why my code is not working can someone please explain to me what am doing wrong

function whatIsInAName(collection, source) {
 const arr = [];
 // Only change code below this line
 let ques = Object.values(source);
 let array = [];
   for (let i of collection) {
       if (array.hasOwnProperty(ques)) {
 // 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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36

Challenge: Wherefore art thou

Link to the challenge:

The first hint I would give you is that the hasOwnProperty method is designed to work on objects, not arrays. You can technically call it on an array but in this instance you are not going to get the results you expect.

The second hint is that you definitely do not need to add another storage array into the mix, the one provided by default is enough. And technically, you don’t even need that one.

1 Like

Thank you for the hint now i can get back on the right track :pray: :pray:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.