Intermediate Algorithm Scripting - Make a Person

Tell us what’s happening:
Describe your issue in detail here.

Look at the area I left a comment. How do I change the global variable when the setter has the same name?

  **Your code so far**
const Person = function(firstAndLast) {
// Only change code below this line
// Complete the method below and implement the others similarly

this.getFullName = function() {
  return firstAndLast;
};
this.getFirstName = function() {
  let strArr = firstAndLast.split(" ")
  return strArr[0];
};
this.getLastName = function() {
  let strArr = firstAndLast.split(" ")
  return strArr[1];
};

this.setFirstName = function(first) {
  let strArr = firstAndLast.split(" ")
  strArr[0] = first;
  firstAndLast = strArr.join(" ");
  return firstAndLast;
};
this.setLastName = function(last) {
  let strArr = firstAndLast.split(" ")
  strArr[1] = last;
  firstAndLast = strArr.join(" ");
  return firstAndLast;
};
this.setFullName = function(firstAndLast) { //how do I access the global variable?
  firstAndLast = firstAndLast
  return firstAndLast;
};

return firstAndLast;
};

const bob = new Person('Bob Ross');
console.log(bob.getFullName());
console.log(bob.getFirstName());
console.log(bob.getLastName());

console.log(Object.keys(bob).length)

console.log(bob.setFirstName("Haskell"));
console.log(bob.getFullName());

console.log(bob.setLastName("Curry"));
console.log(bob.getFullName());

console.log(bob.setFullName("New Name"));
console.log(bob.getFullName());


  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36

Challenge: Intermediate Algorithm Scripting - Make a Person

Link to the challenge:

if you give name to a local variable and it’s the same of a variable in a outer scope, you loose access to the variable of the same name in the outer scope. That means that like that you can’t

Ok, the question made it seem like I wasn’t allowed to do that. Now I know, thanks.