Make a Person: My code doesn't seem to pass some tests

Make a Person: My code doesn't seem to pass some tests
0.0 0

#1

Tell us what’s happening:

What’s wrong with my code? I’ve tried to test them on JS bin and they seem to be fine?

Your code so far


var Person = function(firstAndLast) {
  // 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.setLastName = function(last){
    fullName = `${fullName.split(" ")[0]} ${last}`;
  }
  
  this.setFirstName = function(first){
    fullName = `${first} ${fullName.split(" ")[1]}`;
    return fullName;
  }
  
  this.setFullname = function(firstAndLast){
    fullName = firstAndLast;
  }
  

};

var bob = new Person('Bob Ross');
bob.getFullName();
bob.getFirstName();
bob.getLastName();
bob.setFirstName("Haskell");
bob.setLastName("Meow");

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/make-a-person/


#2

Nevermind. I figured it out. :smiley: