Created
August 11, 2015 02:25
-
-
Save svahora/4bbd3d5f83a3467537ea 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
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