hey guys so I'm trying to solve this problem here
Make a function that looks through a list (first argument) and returns an array of all objects that have equivalent property values (second argument).
but i can't seem to loop thru an array of objects if my life depended on it..... Here is my following code
function where(collection, source) {
for(var prop in collection){
if(collection.hasOwnProperty(prop)){
console.log("collection." + prop + "=" + collection[prop]);
}
}
}
where([{ first: 'Romeo', last: 'Montague' }, { first: 'Mercutio', last: null }, { first: 'Tybalt', last: 'Capulet' }], { last: 'Capulet' });
i was reading documents on hasOwnProperty method and for in loops but it seems like I am utilizing them wrong, any guidance is appreciated, thanks.
THIS IS NOT A DUPLICATE