Hi there,
I’m having trouble to submit a correct code on one of the problems. it is “Make a Person” under “Advanced Algorithm Scripting”.
The test case that returns false is "bob.getFullName() should return “Haskell Curry” after bob.setLastName(“Curry”). "
I tested my code outside freeCodeCamp and it works on each test case. Could you help me with this problem please?
My code:
var Person = function(firstAndLast) {
// Complete the method below and implement the others similarly
this.getFirstName = function() {
return firstAndLast.split(' ')[0];
};
this.getLastName = function() {
return firstAndLast.split(' ')[1];
};
this.getFullName = function() {
return firstAndLast;
};
this.setFirstName = function(firstName) {
bob = new Person(firstName + " " + this.getLastName());
};
this.setLastName = function(lastName) {
bob = new Person(this.getFirstName() + " " + lastName);
};
this.setFullName = function(fullName) {
bob = new Person(fullName);
};
};
var bob = new Person('Bob Ross');