Make a Person help

this should be working ???

Your code so far

var Person = function (firstAndLast) {
  // Complete the method below and implement the others similarly
  this.getFullName = function () {
    var array = firstAndLast.split(" ");
    this.getFirstName = function () {
      return array[0];
    this.getLastName = function () {
      return array[1];
    this.getFullName = function () {
      return array[0] + " " + array[1]
    this.setFirstName = function (first) {
      array[0] = first;
    this.setLastName = function (last) {
      array[1] = last;
    this.setFullName = function (firstAndLast) {
      var arraySplit = firstAndLast.split(" ");


Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:69.0) Gecko/20100101 Firefox/69.0.

Link to the challenge:

What do the failing tests say? What different things have you tried? Have you been able to narrow down the problem at all?

Why do you have two getFullName methods? You should only have one and it should be independent from the other methods. Currently, you another getFullName method and all the others nested in the outer this.getFullName.

EDIT: If you move all the nested methods out of the outer getFullName method and delete it, your code will pass the tests.

It looks like you aren’t saving the array anywhere. In this.getFullName, you save array in the method, but that will only get scoped to that method, not the overall object.

Also, not entirely sure about the this.setFirst/LastName functions. It seems as if you’re setting the array index to a first and a last, but if you’re passing firstAndLast to the constructor, where are you going to be able to get first and last from?