Tell us what’s happening:
Could someone tell me why the following code is not passing this requirement:
Requirement: bob.getFullName()
should return “Haskell Curry” after bob.setLastName("Curry")
I’m passing every other requirement of this challenge.
Your code so far
var Person = function(firstAndLast) {
// Only change code below this line
// Complete the method below and implement the others similarly
var fullName = firstAndLast
this.getFullName = function() {
return fullName;
}
this.getFirstName = function(){
return fullName.split(" ")[0];
}
this.getLastName = function(){
return fullName.split(" ")[1];
}
this.setFirstName = function(newName){
return fullName = newName + " " + this.getLastName();
}
this.setLastName = function(newName){
return fullname = this.getFirstName() + " " + newName;
}
this.setFullName = function(newName){
return fullName = newName;
}
};
var bob = new Person('Bob Ross');
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36
.
Challenge: Make a Person
Link to the challenge: