I am dealing with multiple arrays of objects
x=[ {a:1}, {b:2}, {c:3}, {d:4} ]
y=[ {e:5}, {f:6}, {g:7}, {h:8} ]
(etc)
and I have a list of references pointing to the objects I need to replace.
Instead of having an index into the array, I hold references to the items I want to update
An example reference might look like this: r=x[2]
or r=y[0]
How can I utilize this reference to substitute the element within the original array regardless of which array it belongs to?
Trying to do this directly will not work: r = {a:'new'}
, as it just modifies r, NOT the array's element
This method is not convenient either: r.a='new'
, since my objects are complicated, comprising numerous properties, and I prefer not updating them one by one.
Many thanks!