In my TypeScript program, I have an array which looks like the following:
array = [
{
id,
...
nested: [
{
id,
..
},
{
id,
..
}
]
},
...
]
I need to create a copy of this array, but all methods I've found online (including this thread only seem to work with an array of objects and not the nested kind here (as the nested array is also operated upon). Whilst JSON.parse(JSON.stringify(array))
could have worked, I have a date property in the object which must be preserved.
What can I do?
EDIT: Not sure why this has been marked as duplicate, but I specifically make reference to the fact that that thread does not work in this case.