Tell us what’s happening:
Your code so far
var Person = function(str) {
// Complete the method below and implement the others similarly
this.getFullName = function() {
return str;
};
this.getFirstName = function() {
return str.split(" ")[0];
};
this.getLastName = function() {
return str.split(" ")[1];
};
this.setFullName = function(firstandlast) {
str=firstandlast;
return str;
};
this.setFirstName = function(first) {
var x = str.split(" ");
x[0]=first;
return x.join(" ");
};
this.setLastName = function(last) {
var y=str.split(" ");
y[1]=last;
return y.join(" ");
};
return str;
};
var bob = new Person('Bob Ross');
bob.getFullName();
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36
.
Link to the challenge:
https://www.freecodecamp.org/challenges/make-a-person