I have this array:
let myArray = [
{
id: 20,
comments: {
TICOL: 'This is a new comment'
},
result: 'my results'
}
];
Now I'm trying to update the TICOL property by first creating a copy of the array like this:
let someArray = [...myArray];
let finalArray = someArray.map(obj => {
obj.comments.TICOL = obj.comments.TICOL.replaceAll('new', 'TEST')
});
But finalArray is always [undefined]
. Can anyone tell me what I'm missing? Thanks