Question: I wrote a javascript code like this:

```
var var1 = 1;
window.var2 = 2;

```

Now on the chrome console, I typed `window` and looked through it, but I cannot find the first variable and only the second one showed up. I suppose both of these variables should exist on global window object.
Can someone clarify why is this?

Answer: 
Both variables are visible in the windows object:

```js
var var1 = 1;
window.var2 = 2;
console.log(Object.keys(window).filter(k=>k.substr(0,3)=='var'));
```

This will produce:

```
[
  "var1",
  "var2"
]

```
It seems it was due the fact that I put `type="module"` attribute inside `script` tag. Removing that, I am able to see it on global window object.

```
<script type="module" src="js/app.js"></script>

```