var x = { value: 1, next: null};
var x = { value: 2, next: x};
The object pointed by x at the end of line 2 has null in the next field. When you remove "var" at the begging of line 2, the next field will point to an object with value 1. According to the semantics of JavaScript, "redeclaration of a variable will not lose its value" (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/var). So the code without var on the second line should behave similar to the one with var.
With the program:
The object pointed by x at the end of line 2 has null in the next field. When you remove "var" at the begging of line 2, the next field will point to an object with value 1. According to the semantics of JavaScript, "redeclaration of a variable will not lose its value" (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/var). So the code without var on the second line should behave similar to the one with var.