So this is my code for that challenge
var Person = function(firstAndLast) {
// Only change code below this line
let arr = firstAndLast.split(" ");
// Complete the method below and implement the others similarly
this.getFullName = function() {
let fullName = "";
for(let i = 0; i < arr.length; i++){
fullName += arr[i] + " ";
}
return fullName;
};
this.getFirstName = () => arr[0]
this.getLastName = () => arr[1];
this.setFirstName = function(first){
return arr[0] = first;
}
this.setLastName = last => arr[1] = last;
this.setFullName = function(firstAndLast){
let newarr = firstAndLast.split(" ");
let newFullName = "";
for(let i = 0; i < newarr.length; i++){
newFullName += newarr[i] + " ";
}
return newFullName;
}
return firstAndLast;
};
All my console log tests show correct results, still the test doesn’t pass. What am i missing?