Skip to main content

JavaScript Question 116

Question 116 of 0JavaScript

What's the output?

Login Required

Please login to select answers and solve this question. You can view the question without logging in.

Code:
const person = {
  name: 'Lydia',
  age: 21,
};

const changeAge = (x = { ...person }) => (x.age += 1);
const changeAgeAndName = (x = { ...person }) => {
  x.age += 1;
  x.name = 'Sarah';
};

changeAge(person);
changeAgeAndName();

console.log(person);

Select the correct option: