Skip to content

Instantly share code, notes, and snippets.

@clive-bunting
Created December 5, 2015 10:19
Show Gist options
  • Select an option

  • Save clive-bunting/c5bf3d1d9f7c32e06e2a to your computer and use it in GitHub Desktop.

Select an option

Save clive-bunting/c5bf3d1d9f7c32e06e2a to your computer and use it in GitHub Desktop.
Bonfire: Make a Person
// Bonfire: Make a Person
// Author: @clive-bunting
// Challenge: http://www.freecodecamp.com/challenges/bonfire-make-a-person#
// Learn to Code at Free Code Camp (www.freecodecamp.com)
var Person = function(firstAndLast) {
var firstName = firstAndLast.split(' ')[0];
var lastName = firstAndLast.split(' ')[1];
this.getFirstName = function() {
return firstName;
};
this.getLastName = function() {
return lastName;
};
this.getFullName = function() {
var fullName = firstName.concat(' ').concat(lastName);
console.log(fullName);
return fullName;
};
this.setFirstName = function(name) {
firstName = name;
};
this.setLastName = function(surname) {
lastName = surname;
};
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