Wherefore art thou returning for more

Tell us what’s happening:
can’t check for more than two keys passed as arguments and for their values.

Your code so far

function whatIsInAName(collection, source) {
    // What's in a name?
    var arr = [];
    // Only change code below this line
     var obj=null;
      collection.forEach(element => obj= element);
      var keys=[];
      for(name in obj)
      {  keys.push(name);}
    arr= collection.filter((item)=>{ return (item[keys[0]]===(source[keys[0]]))})
    console.log(arr);   }
     else if(source.hasOwnProperty(keys[1]))
        arr= collection.filter((item)=>{ return (item[keys[1]]===(source[keys[1]]))})          
    // Only change code above this line

    return arr;

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.119 Safari/537.36.

Link to the challenge:

What do you think this part of code does?

collection.forEach(element => (obj = element));
// console.log(obj);
const keys = [];
for (name in obj) {

Next you go through the first two keys from keys array and do some filtering. Why only first two keys?