ProfileLockup Test

Code some please help with this task…?

function lookUpProfile(name, prop){
// Only change code below this line
for (var i = 0; i < contacts.length; i++){
  if (contacts[i].firstName === firstName) {
    if (contacts[i].hasOwnProperty(prop)) {
      return contacts[i][prop];
      } else {
      return “No such property”;
      }
    }
}
return “No such contact”;
// Only change code above this line
}

I’ve edited your post for readability. When you enter a code block into the forum, precede it with a line of three backticks and follow it with a line of three backticks to make easier to read. See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

markdown_Forums

When you return inside a for loop, it exits the function.

Thanx for the note, I do appreciate it!