Tell us what’s happening:
Why bob.getFullName() returns ‘Bob Ross’ rather than 'ff ll’
Your code so far
var Person = function(firstAndLast) {
let name = firstAndLast.split(' ');
var firstName = name[0];
var lastName = name[1];
var fullName = firstName + ' ' + lastName;
this.getFullName = function() {
return fullName;
};
this.getFirstName= function(){
return firstName;
};
this.getLastName= function(){
return lastName;
};
this.setFirstName= function(first){
firstName = first;
};
this.setLastName= function(last){
lastName = last;
};
this.setFullName= function(firstAndLast){
fullName = firstAndLast;
};
};
var bob = new Person('Bob Ross');
bob.setLastName('ll');
bob.setFirstName('ff');
console.log(bob.getFirstName());
console.log(bob.getLastName());
console.log(bob.getFullName());
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.146 Safari/537.36
.
Link to the challenge: