Beginner
Edit a nested object without mutating
The profile state is { name: "Asha", address: { city: "Pune", pin: "411001" } }. The paragraph id="summary" shows Asha lives in Pune (411001).
Make the button id="move" change the city to Mumbai and the pin to 400001, and the button id="rename" change the name to Ravi. The starter mutates the object, so nothing updates. Create new objects instead.
What Check tests
- It starts as
Asha lives in Pune (411001) - Move shows
Asha lives in Mumbai (400001) - Rename then shows
Ravi lives in Mumbai (400001) - The code no longer assigns to fields of
person
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
Runs in your browser. Your code is saved here.
Your page
Press Run to see the page.
Console
Nothing logged yet.