Tell us what’s happening:
Please, can someone help me with this? I can not understand why some tests do not pass, in the end of the code I manually tested the answers with console.log and looks fine. Also looked for the answers length and type, everything looks just fine.
Thanks
Your code so far
var Person = function(firstAndLast) {
// Complete the method below and implement the others similarly
let full = firstAndLast.split(" ")
this.getFullName = function() {
return full.join(" ");
};
this.getFirstName = function() {
return full[0];
};
this.getLastName = function(){
return full[1];
}
this.setFirstName = function(first){
full[0] = first;
}
this.setLastName = function(last){
full[1] = last;
}
this.setFullName = function(firstAndLast){
full = firstAndLast.split(" ");
}
};
var bob = new Person('Bob Ross');
console.log(bob.getFirstName());
console.log(bob.getLastName());
console.log(bob.getFullName());
bob.setFirstName("Haskell");
console.log(bob.getFullName())
bob.setLastName("Curry");
console.log(bob.getFullName())
bob.setFullName("Haskell Curry")
console.log(bob.getFirstName())
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36
.
Challenge: Make a Person
Link to the challenge: