Relationship between globals, Realms, and global environment records

Domenic Denicola d at domenic.me
Tue Nov 25 09:01:40 PST 2014


However, interestingly:

```js
onload = function () {
  var oldSelf = self;
  self.x = "test";
  console.log(self.x); // "test" of course
  console.log(x); // "test"
  document.open("text/html");
  console.log(self.x); // undefined
  console.log(x); // "test" still
  console.log(self === oldSelf); // true
};
```

So, if I'm using my terms correctly, the "global environment record" contains the same variables, even though the global object has a completely new set of properties?



More information about the es-discuss mailing list