If I write the following code:
var foo = [1, 2, 3, 4];
var bar = foo;
Object.freeze(bar);
Does this mean foo
is also immutable?
If not, how can bar
remain constant if foo
is updated?
If I write the following code:
var foo = [1, 2, 3, 4];
var bar = foo;
Object.freeze(bar);
Does this mean foo
is also immutable?
If not, how can bar
remain constant if foo
is updated?