Untitled

mail@pastecode.io avatar
unknown
plain_text
3 years ago
217 B
1
Indexable
Never

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