Can't pass all tests even when I tried on vscode I have the correct result

Tell us what’s happening:
can’t pass all tests even when I tried on vscode I have got the correct results. Only the last three tests can’t pass on freecodecamp.

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

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

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

Your code so far

var Person = function(firstAndLast) {
// Only change code below this line
// Complete the method below and implement the others similarly
let fullName = firstAndLast;
let firstName = fullName.split(' ')[0];
let lastName = fullName.split(' ')[1];
this.getFullName = function() {
  return `${this.getFirstName()} ${this.getLastName()}`;
this.setFullName = (full_Name) =>{
  fullName = full_Name;
this.getFirstName = () =>{
  return firstName;
this.getLastName = () =>{
  return lastName;
this.setFirstName = (fName) =>{
  firstName = fName;
this.setLastName = (lName) =>{
  lastName = lName;

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

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36.

Challenge: Make a Person

Link to the challenge:

Hey man,
Its syntax is perfect, but the problem is in the logic.
Look, the console returns that only two methods are incorrect. Good.
But the console can give a false reality.

Its two variables firstName and lastName don’t work well, what I mean is that when you show the first getFisrtName () ok, but if you set the first name to “Curry”, you actually change the variable “let firstName” to " Curry "and if you show getFirstName (), you are not using the fullName split method. (firstName = “Curry”). \o/

From what I’ve seen of your syntax, you’re on the right track to find the answer. But any other stone on the way is just talking.

1 Like

have you ever updated firstName after giving your person a new fullName?

1 Like

No, I haven’t and it works after I updated all inside setFullName.