Tell us what’s happening:
i’m failing to pass these two tests
bob.getFirstName()
should return “Haskell” after bob.setFullName("Haskell Curry")
.
bob.getLastName()
should return “Curry” after bob.setFullName("Haskell Curry")
.
Your code so far
var Person = function(firstAndLast) {
// Complete the method below and implement the others similarly
let arr = firstAndLast.split(" ");
let firstName = arr[0];
let lastName = arr[1];
let fullName = firstName + " " + lastName;
this.getFirstName = function() {
return firstName;
};
this.getLastName = function() {
return lastName;
};
this.getFullName = function() {
return fullName;
};
this.setFirstName = function(first) {
fullName = first + " " + lastName;
};
this.setLastName = function(last) {
fullName = firstName + " " + last;
};
this.setFullName = function(firstAndLast) {
fullName = firstAndLast;
};
};
var bob = new Person('Bob Ross');
console.log(bob.getFullName());
console.log(bob.getFirstName())
console.log(bob.getLastName())
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36
.
Challenge: Make a Person
Link to the challenge: