why str var is not getting changed ? its still bob ross
var Person = function(firstAndLast) {
// Complete the method below and implement the others similarly
var str = firstAndLast;
this.getFullName = function() {
return str;
};
this.getFirstName = function(){
return str.split(" ")[0];
};
this.setFirstName =function(first){
str = str.split(" ");
str[0] = first;
str = str.join(" ");
//console.log(str);
}
this.getLastName = function(){
return str.split(" ")[1];
};
this.getFullName= function(){
return firstAndLast;
}
return firstAndLast;
};
var bob = new Person('Bob Ross');
console.log(bob.getFirstName());
bob.setFirstName("Haskell");
console.log(bob.getFullName());