Make a Person lesson

Tell us what’s happening:

Your code so far


var Person = function(firstAndLast) {
var array = firstAndLast.split(" ");

this.getFirstName = function() {
  return array[0];
};

this.getLastname = function() {
return array[1];
};

this.getFullName = function() {
return array[0] + " " + array[1];
};

this.setFirstName = function(first) {
array[0] = first;
};

this.setLastName = function(last) {
array[1] = last;
};

this.setFullName = function(firstAndLast) {
var arraySplit = firstAndLast.split(" ");
this.setFirstName(arraySplit[0]);
this.setLastName(arraySplit[1]);
};

};

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


Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:76.0) Gecko/20100101 Firefox/76.0.

Challenge: Make a Person

Link to the challenge:

Two tests are still coming in wrong.

bob.getLastName() should return “Ross”.

bob.getLastName() should return “Curry” after bob.setFullName("Haskell Curry") .

What is wrong? Thank you for your help.

Look at the browser’s console when you run the test. You will find you are trying to call a method that does not exist because of a typo.

2 Likes

Duh, that was so simple! Thanks so much! I probably should look way closer at my code in the future before I rush to the forum. :wink: