1const userProfile = {
2 username: 'Jack',
3 email: 'Jack@email',
4 socialMedia: {
5 twitter: '@jack',
6 facebook: 'jackm',
7 linkedIn: 'jackmay',
8 },
9}
10const newUserProfile = {
11 ...userProfile,
12 email: 'JackNew@email',
13 socialMedia: { ...userProfile.socialMedia, twitter: '@newTwitter' },
14}
15// const newUserProfile = JSON.parse(JSON.stringify(userProfile))
16console.log('orginal', userProfile)
17console.log('new', newUserProfile)