-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspread.js
More file actions
90 lines (87 loc) · 1.57 KB
/
spread.js
File metadata and controls
90 lines (87 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
const appData = {
user: {
id: 101,
name: "John Doe",
preferences: {
theme: "dark",
notifications: {
email: true,
sms: false,
push: {
enabled: true,
sound: "chime",
times: ["08:00", "20:00"],
},
},
},
address: {
billing: {
line1: "123 Main St",
city: "New York",
zip: "10001",
},
shipping: {
line1: "456 Market Ave",
city: "San Francisco",
zip: "94105",
},
},
},
cart: {
items: [
{
id: "p1",
name: "Wireless Mouse",
qty: 2,
price: 25.5,
metadata: {
warranty: "1 year",
availability: {
inStock: true,
warehouse: "LA-2",
},
},
},
{
id: "p2",
name: "Mechanical Keyboard",
qty: 1,
price: 89.99,
metadata: {
warranty: "2 years",
availability: {
inStock: false,
warehouse: "NY-1",
},
},
},
],
coupon: {
code: "NEWUSER10",
discount: 10,
applied: true,
},
},
settings: {
version: "1.4.2",
features: {
wishlist: true,
multiAddress: true,
recommendations: {
enabled: true,
sources: ["browsingHistory", "similarUsers"],
},
},
},
name: "revathi",
};
const updatedObject = {
...appData,
user: {
...appData.user,
name: "sudhakar",
},
name: "sudha",
};
console.log(updatedObject);
console.log(appData);