Challenge: Shallow to Deep
This challenge will test your understanding of shallow copying and your skills in implementing deep copying in JavaScript.
We'll cover the following...
We'll cover the following...
Problem statement #
Study the code below and run it.
Press + to interact
Node.js
const girl = {name: 'Anna',info: { age: 20, number: 123 }};const newGirl = { ...girl };newGirl.info.age = 30;console.log(girl.info.age)
As explained in a previous lesson, newGirl
is a shallow ...