Skip to content

Instantly share code, notes, and snippets.

@SterlingAr
Created January 14, 2017 17:14
Show Gist options
  • Save SterlingAr/9d733efc0219c7ec6bf019c93eb2af20 to your computer and use it in GitHub Desktop.
Save SterlingAr/9d733efc0219c7ec6bf019c93eb2af20 to your computer and use it in GitHub Desktop.
var result;
for ( var i = 0 ; i < contacts.length; i++){
if(contacts[i].hasOwnProperty(firstName)){
if(contacts[i].hasOwnProperty(prop)){
result = contacts[i].prop;
}else{
result = "No such property";
}
}else{
result = "No such contact";
}
}
return result;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment