suggest i have this object of nested array
let order={
a:1
b:2
service:[
1:{a:1,b:3},
2:{a:3,b:4}
]
}
so i want to insert object to service array with new dynamic id i tried that
let serviceOrder={a:5,b:6}
let id=uuid4(); //example 4
let newSer={...order.service,id:serviceOrder}
```
but i get this
service:[
1:{a:1,b:3},
2:{a:3,b:4},
id:{a:5,b:6}
]
whereas i want to get this
service:[
1:{a:1,b:3},
2:{a:3,b:4},
3:{a:5,b:6}
]
so how i can do this thank in advance to help