Last active
August 29, 2015 14:16
-
-
Save aldraco/058d4837dfd1fbf5fcef to your computer and use it in GitHub Desktop.
make a person bonfire FCC (WIP) - TODO does not pass instance of Person test.
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) { | |
//private variables | |
var name = firstAndLast; | |
var firstName = name.split(' ')[0]; | |
var lastName = name.split(' ')[1]; | |
//updated to pass the bonfire test | |
this.getFullName = function() { | |
return name; | |
}; | |
this.getLastName = function() { | |
return lastName; | |
}; | |
this.getFirstName = function() { | |
return firstName; | |
}; | |
this.setFullName = function(input) { | |
name = input; | |
}; | |
this.setFirstName = function(input) { | |
firstName = input; | |
}; | |
this.setLastName = function(input) { | |
lastName = input; | |
}; | |
}; | |
var bob = new Person('Bob Ross'); | |
console.log(Object.getPrototypeOf(bob)); | |
bob.getFullName(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment