Make a Person challenge won't validate fully

Tell us what’s happening:

Hey all, In the “make a person challenge” I’ m passing every test apart from :
bob.getFullName() should return “Haskell Curry” after bob.setLastName(“Curry”) ;
I can’t see anything wrong in my code Can you spot the error?

Your code so far

	// Complete the method below and implement the others similarly
	var firstName = "Bob";
	var lastName = "Ross"
	this.getFirstName = function () {
		return firstName;
	};
	this.getLastName = function () {
		return lastName;
	};
	this.getFullName = function () {
		return firstName + " " + lastName;
	};
	this.setFirstName = function (first) {
		firstName = first;
	};
	this.setLastName = function (last) {
		lastName = last;
	};
	this.setFullName = function (firstAndLast) {
		var nameArr =firstAndLast.split(" ");
		firstName = nameArr[0];
		lastName = nameArr[1];
	};
};

var bob = new Person('Bob Ross');

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.110 Safari/537.36.

Link to the challenge:
https://www.freecodecamp.org/challenges/make-a-person

Found the issue myself I was missing the initialization:
// Complete the method below and implement the others similarly
var firstName = firstAndLast.split(" “)[0];
var lastName = firstAndLast.split(” ")[1]

You are hardcoding the person to always start with the name “Bob Ross”.

1 Like