0 of 8 problems solved • 0%

Exercise prompt

Copy an Object with Spread

Object spread copies properties into a new object.

Example

const original = { theme: "dark" }; const copy = { ...original };
  • { ...original } creates a separate object with the same properties.
  • Setting copy.theme to "light" leaves original.theme equal to "dark".

This is a shallow copy: nested arrays or objects would still be shared.

Your task

Replace the direct assignment with a spread copy, then change only profileCopy.city to Umeå. Display both cities.

Hint

A spread copy gives the update a different object to change.