Use of splice in an object method

Tell us what’s happening:
Can someone please tell me why the setter method does not work with
fullName = fullName.split(" “).splice(1, 1, input).join(” ")
but works with a simple concatenation as demonstrated below

Thanks for the help!

Your code so far


var Person = function(firstAndLast) {
// Only change code below this line
// Complete the method below and implement the others similarly
let fullName = firstAndLast
this.getFullName = function() {
  // console.log(fullName)
  return fullName;
};
this.getLastName = function() {
  return fullName.split(' ')[1];
};
this.getFirstName = function() {
      return fullName.split(' ')[0];
};
this.setFullName = function(input) {
// Insert your code here
    fullName = input
    // console.log(fullName)
};
this.setLastName = function(input) {
// Insert your code here
    fullName = fullName.split(' ')[0] + " " + input
    // console.log(fullName)
};
this.setFirstName = function(input) {
// Insert your code here
    fullName = input + " " + fullName.split(' ')[1]

};
return firstAndLast;
};

var bob = new Person('Bob Ross');
bob.getFullName();
bob.setLastName("Curry");

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0.

Challenge: Make a Person

Link to the challenge:

Hello there,

It is because of what splice returns: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice

Think about what join does with this return value…

Hope this helps