Wherefore art thou filter not working

right now I’m trying to figure out why this filter isn’t woking, in just trying to get an array back of the collection objects that have the property in the source parameter. it just returns an empty array.

 const keys = Object.keys(source);
  let newArr = collection.filter((obj) => {
    keys.forEach((e) => {
      if (obj.hasOwnProperty(e)) {
        return true;
      } else {
        return false;

forEach returns undefined

maybe you need a different method?

but also the callback of the filter method doesn’t have a return statement, so it is also returning undefined by default