Help with basic JavaScript tutorial

This is for the basic javaScript Profile lookup solution. This should work. I have no idea why it isn’t.

function lookUpProfile(name, prop){
  for (var i = 0; i < contacts.length; i++) {
    if (contacts[i].firstName === name) {
      if (contacts[i].hasOwnProperty(prop)) {
        return contacts[i][prop];
      } else {
        return "No such property";
      }
    } else {
      return "No such contact";
    }
  }
}

yeah, i just asked for the hint. I found the solution at the bottom… and what I did is basically the same as the solution. except mine doesn’t have any syntax errors. Please Help!

What does the failing test say?

@dustyhawkins - In your solution, do you understand what happens if the firstname property’s value of the first contact (contacts[0]) does not match the name argument?