I'm trying to do something like this:
var obj={o:"a string"};
var o=obj.o
console.log(o)
o='modified'
console.log(o)
console.log(obj.o)
The result is:
a string
modified
a string
But I expect it to be:
a string
modified
modified
I tried destructuring too without success: it seems that the property and the variable are not linked.
Is there a way to link o to obj.o ? I don't want to use obj.o to modify obj property, but o instead.
Thank you in advance for your help.