Advertisement
Guest User

Untitled

a guest
Feb 3rd, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. function lookUp(firstName, prop){
  2. // Only change code below this line
  3. var result;
  4. for (var x = 0; x < contacts.length; x++){
  5. if (contacts[x].firstName === firstName) {
  6. if (contacts[x][prop]) {
  7. return contacts[x][prop];
  8. } else {
  9. return "No such property";
  10. }
  11. }
  12. }
  13. return "No such contact";
  14. // Only change code above this line
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement