Skip to content

Instantly share code, notes, and snippets.

@DennyScott
Created July 12, 2019 04:49
Show Gist options
  • Save DennyScott/ffcea61b454280263732853d7b221d61 to your computer and use it in GitHub Desktop.
Save DennyScott/ffcea61b454280263732853d7b221d61 to your computer and use it in GitHub Desktop.
const personOne = {
firstName: “Denny”,
lastName: “Scott”,
contact: {
phoneNumber: 555–555–5555,
twitter: “
@gitinbit”
}
}
function getUserForPhoneDirectory(person) {
if(person && person.firstName && person.lastName && person.contact && person.contact.phoneNumber) {
return `${person.firstName} ${person.lastName} — ${person.contact.phoneNumber}`
}
}
getUserForPhoneDirectory(personOne); //expect: Denny Scott — 555–555–5555
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment