I'm trying to have both the variables "my_a" and letters.a point to the same object.
//i want letters.a to reference (point to) my_a, not be a copy...
//expected output should be: letters.a = c
//made variables into Objects.. but didn't help.
var my_a = new Object('a');
var my_b = new Object('b');
var letters = {'a': my_a, 'b': my_b};
$('#output').append('my_a = ' + my_a + '<br>');
$('#output').append('leters.a = ' + letters.a + '<br>');
my_a = new Object('c');
$('#output').append('my_a = ' + my_a + '<br>');
$('#output').append('letters.a = <span style="color:red">' + letters.a + '</span>');
See this fiddle:
But as you can see by the output, this is not working.
Any ideas? Is this possible with javascript?
Thank you.