Skip to content

Instantly share code, notes, and snippets.

@ahmadabdul3
Created February 9, 2022 13:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahmadabdul3/fda70021afc29e4dcf4b988664b19b63 to your computer and use it in GitHub Desktop.
Save ahmadabdul3/fda70021afc29e4dcf4b988664b19b63 to your computer and use it in GitHub Desktop.
class UserModel {
user = {
firstName: 'Jane',
middleName: 'Liz',
lastName: 'Doe',
};
getFullName({ short } = {}) {
const { firstName, middleName, lastName } = this.user;
if (short) return firstName + ' ' + lastName;
return firstName + ' ' + middleName + ' ' + lastName;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment