Skip to content

Instantly share code, notes, and snippets.

@jaamaalxyz
Created July 12, 2018 11:19
Show Gist options
  • Save jaamaalxyz/c9b44d77f1aecd79a32a3521a61dbfb9 to your computer and use it in GitHub Desktop.
Save jaamaalxyz/c9b44d77f1aecd79a32a3521a61dbfb9 to your computer and use it in GitHub Desktop.
var Person = function(firstAndLast) {
let firstName = firstAndLast.split(' ')[0];
let lastName = firstAndLast.split(' ')[1];
this.getFirstName = function(){
return firstName;
};
this.getLastName = function(){
return lastName;
};
this.getFullName = function(){
return firstName + ' ' + lastName;
};
this.setFirstName = function(first){
firstName = first;
};
this.setLastName = function(last){
lastName = last;
};
this.setFullName = function(firstAndLast){
firstName = firstAndLast.split(' ')[0];
lastName = firstAndLast.split(' ')[1];
};
};
var bob = new Person('Bob Ross');
bob.getFullName();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment