Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
const maybePerson = getPerson();
if (maybePerson) {
console.log(maybePerson.name);
}
if (maybePerson && maybePerson.name) {
console.log(maybePerson.name.firstName);
console.log(maybePerson.name.lastName);
}
if (maybePerson && maybePerson.name && maybePerson.name.getFullName) {
console.log(maybePerson.name.getFullName());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.