Skip to content

Instantly share code, notes, and snippets.

@Narshe1412
Created December 21, 2015 21: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 Narshe1412/952280800c5caafe073e to your computer and use it in GitHub Desktop.
Save Narshe1412/952280800c5caafe073e to your computer and use it in GitHub Desktop.
http://www.freecodecamp.com/narshe1412 's solution for Make a Person
var Person = function(firstAndLast) {
//this.fullName = firstAndLast;
var fullName = firstAndLast;
var splitName = fullName.split(" ");
var first = splitName[0];
var last = splitName[1];
this.getFirstName = function (){
//return first;
return fullName.split(" ")[0];
};
this.getLastName = function(){
return fullName.split(" ")[1];
};
this.getFullName = function(){
return fullName;
};
this.setFirstName = function(val){
fullName = val + ' ' + last;
};
this.setLastName = function(val){
fullName = first + ' ' + val;
};
this.setFullName = function(val){
fullName = val;
};
};
var bob = new Person('Bob Ross');
bob.getFullName();