Make a Person challenge doesn't pass all the tests

My code doesn’t pass all the tests on FCC challenge but it gives the correct output on https://repl.it/ Can anyone please tell me what could be wrong? Am I doing something which is not allowed or a good idea?

Thank you

var Person = function(firstAndLast) {
  // Complete the method below and implement the others similarly

  let x = firstAndLast.split(" ");
  
  this.setFullName = function(full) {
  
   x[0] = full.split(" ")[0];
   x[1] = full.split(" ")[1];
   firstAndLast = x[0] + " " + x[1];
  }

  this.getFullName = function() {
  
    return firstAndLast;
    
  }
  this.getFirstName = function() {  
    
    return x[0];
     
  }

  this.getLastName = function() {  

    return x[1]; 

  }

  this.setFirstName = function(first) {
   
   x[0] = first;
   firstAndLast = x[0] + " " +x[1];
  }

  this.setLastName = function(last) {
   
   x[1] = last;
   firstAndLast = x[0] + " " +x[1];
  } 
  
}

var bob = new Person('Bob Ross');
bob.setLastName("ddd");
bob.getFirstName();

Your browser information:

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

Challenge: Make a Person

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

It must be a bug with FCC test suit. I just copied and paste your solution into the lesson editor and it passed just fine.

1 Like

Hello, proxima.

You confused the tests, by including the last two lines of your script.

Hope this helps

1 Like

Well, it definitely helped.

Silly me :blush:

Thank you very much for your help.