Help need iterative solution Wherefore art thou

Tell us what’s happening:
filter method works but couldn’t do it without higher order function.

Your code so far

function whatIsInAName(collection, source) {
  // What's in a name?
  var arr = [];
  // Only change code below this line
  let key=Object.keys(source);
  let ckey=Object.keys(collection);
  for(let i in collection){
  // Only change code above this line
  return arr;

console.log(JSON.stringify(whatIsInAName([{ "apple": 1, "bat": 2 }, { "bat": 2 }, { "apple": 1, "bat": 2, "cookie": 2 }], { "apple": 1, "bat": 2 })));

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36.

Link to the challenge:

if you use filter you need to put a callback in it, and that is higher order function

Do you have a question about the challenge?

i want a procedural solution (without built in method())

I have added many many console.logs to your code, there is something that goes terribly wrong, as many of your variables start getting value of undefined. You are also missing the check if there is more than one property in the source object.

Run (with the green play button at the top, or you can open it in using the “open in” button) this repl and see what appear in the console: