getFullName is still set to the one applied earliest even after setting it afterwards.
I am new to JS, can anyone please suggest what am I doing wrong?
var Person = function(firstAndLast) {
let fullName = firstAndLast;
this.getFirstName = () => fullName.split(' ')[0];
this.getLastName = () => fullName.split(' ')[1];
this.getFullName = () => fullName;
this.setFirstName = first => fullName = first + " " + fullName.split(" ")[1];
this.setLastName = last => fullName = fullName.split(" ")[0] + " " + last ;
this.setFullName = firstAndLast => firstAndLast;
}
var bob = new Person('Bob Ross');
bob.setFullName("Haskell Curry")
console.log(bob.getFullName())