I’m on the Make a Person Algorithm, my code is as follows:
var Person = function(firstAndLast) {
this.getFirstName = function () {
return this.first;
};
this.getLastName = function () {
return this.last;
};
this.getFullName = function () {
return this.first + " " + this.last;
};
this.setFirstName = function (first) {
this.first = first;
};
this.setLastName = function (last) {
this.last = last;
};
this.setFullName = function (full) {
this.first = full.split(" ")[0];
this.last = full.split(" ")[1];
this.full = this.first + " " + this.last;
};
this.setFirstName(firstAndLast.split(" ")[0]);
this.setLastName(firstAndLast.split(" ")[1]);
this.setFullName(firstAndLast);
};
var bob = new Person('Bob Ross');
// bob.setFirstName("Haskell");
bob.getFullName();
Every test checks except the bob’s length is not 6, my question is that the constructor only has 6 methods, why does the length not return 6?