JS DOESN'T have pointers - but it does have references. I have a solution to my issue which I can post if anyone is interested, but I'm wondering if there is a better way...
Is there any way in JavaScript to get a "reference" to where an object key points? For example:
let anobj = {
a: "aval",
b: {
bprime: "target",
},
b: "bval",
c: "cval"
};
let bptr = getReference(anobj.b.bprime);
bptr = "Updated";
// So that anobj would then be:
{
a: "aval",
b: {
bprime: "Updated",
},
b: "bval",
c: "cval"
};
... or something equivalent. I mean, some way to have a variable/function that represents a deeply nested "location" in an object - that can be used to assign a new value to that node of the original object.
Sorry if that's not a clear expression of my question - it's very clear in my head...