Skip to content

Commit fc8fc01

Browse files
authored
Update Profile_Lookup.js
1 parent c524232 commit fc8fc01

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

Profile_Lookup.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,4 +117,9 @@ function lookUpProfile(firstName, prop) {
117117
return contact ? contact.hasOwnProperty(prop) ? contact[prop] : 'No such property' : 'No such contact';
118118
}
119119
120+
121+
// Another:
122+
123+
return contacts.reduce(function(a, c) {return a ? a : (c.firstName === firstName ? (c.hasOwnProperty(prop) ? c[prop] : "No such property") : "");}, "") || "No such contact";
124+
120125
*/

0 commit comments

Comments
 (0)