Can anyone help for this problem ? What will be the solution?

Tell us what’s happening:

Your code so far


var Person = function(firstAndLast) {
// Complete the method below and implement the others similarly
this.getFullName = function() {
  return "";
};
return firstAndLast;
};

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

Your browser information:

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

Challenge: Make a Person

Link to the challenge:

That just looks like the starter code? What have you tried?

var firstAndLast = firstAndLast.split(" ");

  this.getFullName = function() {

    return firstAndLast.join(" ");

  };

  this.getFirstName = function() {

    return firstAndLast[0];

  };

  this.getLastName = function() {

    return firstAndLast[1];

  };

  this.setFirstName = function(first) {

    firstAndLast[0] = first;

  }

  this.setLastName = function(last) {

    firstAndLast[1] = last;

  }

  this.setFullName = function(firstAndLast) {

   firstAndLast = firstAndLast;
}
};


//IS this  is a correct way to solve this?

where is the Person definition?


I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

Please use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks are not single quotes.

markdown_Forums