Wherefore art thou loop

Wherefore art thou loop
0.0 0


What is wrong with my logic, please explain. It works for the first 3 case, but not the last. I can’t seem to figure out what is wrong with this. Please advise:

This is my first time asking for help, so don’t really know how to post code for review.

function whatIsInAName(collection, source) {
  // What's in a name?
  var arr = [];
  // Only change code below this line
  var checkKeys = Object.keys(source);
  for (var i = 0; i < checkKeys.length; i++){
		for (var j=0; j<collection.length; j++){
			if (collection[j].hasOwnProperty(checkKeys[i]) && collection[j][checkKeys[i]] === source[checkKeys[i]]){
				if (collection[j].hasOwnProperty(checkKeys[i+1]) && collection[j][checkKeys[i+1]] === source[checkKeys[i+1]]){
  // Only change code above this line
  return arr;


Right now you are pushing collection[j] if it has any matching properties, but you need to make sure that it contains all the right properties.