Tell us what’s happening:
The code is not working but I guess it’s because that the method setFullName doesn’t know which variable/argument to edit, I guess? How I fix this?
Your code so far
var Person = function(firstAndLast) {
// Complete the method below and implement the others similarly
var firstAndLast = firstAndLast.split(" ");
this.getFullName = function() {
return firstAndLast.join(" ");
};
this.getFirstName = function() {
return firstAndLast[0];
};
this.getLastName = function() {
return firstAndLast[1];
};
this.setFirstName = function(first) {
firstAndLast[0] = first;
}
this.setLastName = function(last) {
firstAndLast[1] = last;
}
this.setFullName = function(firstAndLast) {
firstAndLast = firstAndLast;
}
};
var bob = new Person('Bob Ross');
bob.setFullName("Haskell Curry");
bob.getFullName();
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:60.0) Gecko/20100101 Firefox/60.0
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/make-a-person