If I have an object like this:
obj = {a:{aa:1}, b:2};
and I want to create a shortcut (pointer to obj.a.aa) x as follows:
x = obj.a.aa;
and then I want to assign the value 3 obj.a.aa using x, like this:
x = 3;
console.log(obj.a.aa);
How can I set x to get the value 3 included in obj.a.aa?
I understand that obj.a.aa is primitive, but how can I define a variable that points to this, which I can then use to assign a value to the property?
source
share