What else is needed or what I haven’t added I’ve got stuck… help me
I filtered the collection and looped the source then checked if not obj in collection is equal to the one(s) in the source return false else return true
And the output is only an empty []
function whatIsInAName(collection, source) {
// What's in a name?
var arr = [];
// Only change code below this line
arr = collection.filter(function(prop) {
for (let ky in source) {
if (prop[source[ky]] !== source[ky]) {
return false;
}
else {
return true;
}
}
})
// Only change code above this line
return arr;
}
console.log(JSON.stringify(whatIsInAName([{ a: 3, b: 4 },{ a: 5, b: null },{ a: 7, b: 8 }],{ b: 8 })));
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/wherefore-art-thou