Make a Person challenge

Make a Person challenge
0

#1

Hi,campers ,I got stuck in this challenge ,I don’t know why is does not pass ,beacuse when I output the tests in the console ,everything is correct .

var Person = function(firstAndLast) {
  // 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(a) {
     return  FirstName=a;
  };
  this.setLastName=function(c) {
    return LastName=c;
  };
  this.setFullName = function(fullName) {
    return fullName;
  };
};
var bob = new Person('Bob Ross');

https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/make-a-person/
please give me a hand .


#2

You are straight returning after you are setting names but look at the test cases. They call get names after they are setting names. So don’t return statements after you set names, just assign them.

This means you will need to make some modifications for your setFullName method.


#3

Thank you man ,this challenge made me so nervous because it took from me a lot of time ,but I got it ,and I solved it , I should have not used strings in the first two variables because string is immutable ,I should make it an array ,and also what you said to me is correct set methodes are made just to mutate the variables.