Skip to content

Instantly share code, notes, and snippets.

@svahora
Created August 11, 2015 02:25
Show Gist options
  • Save svahora/4bbd3d5f83a3467537ea to your computer and use it in GitHub Desktop.
Save svahora/4bbd3d5f83a3467537ea to your computer and use it in GitHub Desktop.
var Person = function(firstAndLast) {
var split = firstAndLast.split(' ');
var firstName = split[0];
var lastName = split[1];
var fullName = split.join(' ');
this.setFirstName = function(first) {
firstName = first;
};
this.setLastName = function(last) {
lastName = last;
};
this.setFullName = function(full) {
fullName = full;
};
this.getFirstName = function() {
return firstName;
};
this.getLastName = function() {
return lastName;
};
this.getFullName = function() {
return fullName;
};
return firstAndLast;
};
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