So far I believed objects in javascript if assigned to another variable were always by reference.
For e.g
var x = {
key1: "key1",
key2: "key2"
}
var y = x
So if I do something like y.key1= "modifiedKey1"
values of key1
in x
witll change too. x.key1 = modifiedKey1
however, when I do this, y = null
or y= "someRandomString"
There is NO change in x
x is not null, it remains the same object.
What exactly is happening?