Tell us what’s happening:
Describe your issue in detail here.
Hello. Could someone help me out with why this code is returning an infinite loop
**Your code so far**
function whatIsInAName(collection, source) {
const arr = [];
// Only change code below this line
const allKeys = Object.keys(source);
for(let i = 0; i < collection.length; i++){for(let j = 0; allKeys.length; j++)
{if(collection[i].hasOwnProperty(allKeys[j]) || collection[allKeys[j]] === source[allKeys[j]]){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 (iPhone; CPU iPhone OS 15_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.4 Mobile/15E148 Safari/604.1
Challenge: Wherefore art thou
Link to the challenge: