Getting errors (all shown below code) when I test my code, however, when I test the code to see if I’m actually getting those errors, it works correctly.
My code:
const Person = function(firstAndLast) {
let firstName = firstAndLast.split(' ')[0];
let lastName = firstAndLast.split(' ')[1];
this.getFullName = function() {
return firstName + " " + lastName;
};
this.getFirstName = function() {
return firstName;
};
this.getLastName = function() {
return lastName;
};
this.setFirstName = function(first) {
return firstName = first;
};
this.setLastName = function(last) {
return lastName = last;
};
this.setFullName = function(first, last) {
this.setFirstName(first);
this.setLastName(last);
return this.getFullName();
};
};
const bob = new Person('Bob Ross');
The errors I’m getting:
- You should not change the function signature.
- The .getLastName() should return the string Ross.
- The .getFullName() method should return the string Bob Ross.
- The .getFullName() method should return the string Haskell Ross after calling .setFirstName(‘Haskell’).
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.82
Challenge: Intermediate Algorithm Scripting - Make a Person
Link to the challenge: