I was trying to change the structure of a Javascript object and I don't understand the results I am receiving from the logs.
I have the following object: a = {e: 1, f: 2}
And I want to move it to a.b
If I do a.b = a then I receive these results:
console.log(a) // {e: 1, f: 2}
console.log(a.b) // {e: 1, f: 2}
While I am expecting something like this:
console.log(a) // {b: {e: 1, f: 2}}
console.log(a.b) // {e: 1, f: 2}
Can someone explain me why this is happening?