Renaming JavaScript Objects

javascript:var foo = {baz: 'bizzer'};
var bar = foo;
bar.baz = 'bazzer';
alert(foo.baz + ' == ' + bar.baz);

As you can see the object’s property of ‘baz’ is updated in both foo object and bar object (a copy or reference to foo).

VN:F [1.8.4_1055]
Rating: 0.0/10 (0 votes cast)
VN:F [1.8.4_1055]
Rating: 0 (from 0 votes)

One Response to “Renaming JavaScript Objects”

  1. Ronnie says:

    Sorry…

    UN:F [1.8.4_1055]
    Rating: 0.0/5 (0 votes cast)
    UN:F [1.8.4_1055]
    Rating: 0 (from 0 votes)

Leave a Reply