A javascript 'let' global variable is not a property of 'window' unlike a global 'var' : <p>I used to check if a global <code>var</code> has been defined with:</p>

<pre><code>if (window['myvar']==null) ...
</code></pre>

<p>or</p>

<pre><code>if (window.myvar==null) ...
</code></pre>

<p>It works with <code>var myvar</code></p>

<p>Now that I am trying to switch to let, this does not work anymore.</p>

<pre><code>var myvar='a';
console.log(window.myvar); // gives me a
let mylet='b';
console.log(window.mylet); // gives me undefined
</code></pre>

<p>Question:
With a global <code>let</code>, is there any place I can look if something has been defined like I could with <code>var</code> from the <code>window</code> object?</p>

<p><b>More generally</b>:<br>
Is <code>var myvar='a'</code> equivalent to <code>window.myvar='a'</code>?<br>
I hear people say that at the global level, <code>let</code> and <code>var</code> are/behave the same, but this is not what I am seeing.</p>
