I have this JavaScript code
x = {"foo": "bar"};
y = {"baz": x};
z = y["baz"]["foo"];
console.log(z);
This code prints bar
x and y both objects. Then z is assigned "y" and "2 arrays". How is this assignment working? I may be reading it all wrong!
I am having a hard time understanding why it is so? Can someone please explain what's going on?