Tell us what’s happening:
Describe your issue in detail here.
My outputs match the outputs required by the tests, yet some of the tests are failing.
Your code so far
const Person = function(firstAndLast) {
// Only change code below this line
// Complete the method below and implement the others similarly
let fullName = firstAndLast;
this.getFullName = function() {
return fullName;
};
this.getFirstName = function() {
return fullName.split(" ")[0];
};
this.getLastName = function() {
return fullName.split(" ")[1];
};
this.setFirstName = function(first) {
fullName = first+" "+fullName.split(" ")[1];
};
this.setLastName = function(last) {
fullName = fullName.split(" ")[0]+" "+last;
};
this.setFullName = function(full) {
fullName = full;
};
return firstAndLast;
};
const bob = new Person('Bob Ross');
//console.log(bob);
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.getFullName());
console.log(bob.getFirstName());
console.log(bob.getLastName());
console.log(bob.fullName);
results of above logs to console:
Bob
Ross
Bob Ross
Haskell Ross
Haskell Curry
Haskell Curry
Haskell
Curry
undefined
undefined
6
true
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36 Edg/106.0.1370.42
Challenge: Intermediate Algorithm Scripting - Make a Person
Link to the challenge: