1arr = [
2 {
3 "id": 1,
4 "status": "pending",
5 "menues": [
6 {
7 "title": "Coke",
8 "price": "200"
9 }
10 ]
11 },
12 {
13 "id": 2,
14 "status": "delivered",
15 "menues": [
16 {
17 "title": "Pepsi",
18 "price": "120"
19 }
20 ]
21 }
22];
23
24arr.forEach(nested => {
25 nested.menues.forEach(menu => menu.status = nested.status);
26 delete nested.status
27});
28console.log(arr);