You've just overriden a with an object that only contains the property y. a = {y: 2} - You can see this when you console.log a.y. These assignments are done right to left.
The very last assignment that occurs here is a = { y: 2 };. This clobbers a.x. Perhaps you were expecting the opposite order of assignments on the last line?
awith an object that only contains the propertyy.a = {y: 2}- You can see this when you console.loga.y. These assignments are done right to left.a.xis evaluated (but not yet written) beforea = {y:2}a = { y: 2 };. This clobbersa.x. Perhaps you were expecting the opposite order of assignments on the last line?