Make a person challenge, returning incorrect value

Make a person challenge, returning incorrect value
0

#1

Hi! Im doing the make a person challenge. The problem are:
Object.keys(bob).length should return 6.
bob.firstName should return undefined.
bob.lastName should return undefined.

. What am i doing wrong?:confused: i dont understand why it should return undefined if the name is set.

var Person = function(firstAndLast) {
    
   firstAndLast=firstAndLast.split(" "); 
   this.firstName=firstAndLast[0];
   this.lastName=firstAndLast[1];
   
   this.getFirstName=function(){
  
    return this.firstName;
  
  
  
   };
   
   this.getLastName=function(){
  
    return this.lastName;
  
  
  
   };
   
   this.getFullName=function(){
  
    return this.firstName+" "+this.lastName;
  
  
  
   };
   
   this.setFirstName=function(first){
  
    this.firstName=first;
  
  
  
   };
  
  this.setLastName=function(last){
  
    this.lastName=last;
  
  
  
   };
  
  this.setFullName=function(firstAndLast){
  
    
    firstAndLast=firstAndLast.split(" "); 
    this.firstName=firstAndLast[0];
    this.lastName=firstAndLast[1];
   
  
   };
  
  

};

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

#2

I believe that firstName and lastName should be private variables. This would get you the undefined responses.


#3

Thank you it works!!!