Last active
October 4, 2016 19:52
-
-
Save tcrosen/ac1c807b7af57cc254bb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person { | |
constructor({ firstName, lastName }) { | |
this.firstName = firstName || 'John'; | |
this.lastName = lastName || 'Doe'; | |
} | |
getFullName() { | |
return this.firstName + ' ' + this.lastName; | |
} | |
} | |
console.log(new Person({}).getFullName()); | |
console.log(new Person({ lastName: 'Smith' }).getFullName()); // John Smith |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment