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? 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();