I directed some of methods in prototype chain, to get object’s keys sum of 6.
Is this cheating, or just the way to do work? I think this is not proper way to do it…
Here is challenge, take a look at first test:
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(name){
this.first = name;
};
this.setFullName(firstAndLast);
};
Person.prototype = {
setFullName: function(firstAndLast){
firstAndLast = firstAndLast.split(' ');
this.first = firstAndLast[0];
this.last = firstAndLast[1];
},
setLastName: function(last){
this.last = last;
},
};
var bob = new Person('Bob Ross');
bob.getFullName();
console.log(Object.keys(bob).length);