Hello everybody, just quick question, could someone tell me why this works for every check except for :
" bob.getFullName()
should return the string Haskell Curry
after bob.setLastName("Curry")
."
Thanks in advance…
const Person = function(firstAndLast) {
// Only change code below this line
// Complete the method below and implement the others similarly
let arr = {
firstName: "Bob",
lastName: "Ross",
}
this.getFirstName = function() {
return arr.firstName;
};
this.getLastName = function() {
return arr.lastName;
};
this.getFullName = function() {
return arr.firstName + " " + arr.lastName;
};
this.setFirstName = function(y) {
arr.firstName = y;
};
this.setLastName = function(z) {
arr.lastName = z;
};
this.setFullName = function(x) {
let value = x.split(" ")
arr.firstName = value[0];
arr.lastName = value[1];
return arr.firstName + " " + arr.lastName;
}
//return firstAndLast;
};
const bob = new Person('Bob Ross');
const bob = new Person('Bob Ross');
bob.getFullName();
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36
Challenge: Intermediate Algorithm Scripting - Make a Person
Link to the challenge: