Take let variable out of temporal dead zone <p>See this code:</p> <p><div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script&gt; let {foo} = null; // TypeError &lt;/script&gt; &lt;script&gt; // Here I want to assign some some value to foo &lt;/script&gt;</code></pre> </div> </div> </p> <p>The first script attempts to let-declare <code>foo</code> via a destructuring assignment. However, <code>null</code> can't be destructured, so the assignment throws a TypeError.</p> <p>The problem is that then the <code>foo</code> variable is declared but uninitialized, so if in the 2nd script I attempt to reference <code>foo</code>, it throws:</p> <pre><code>foo = 123; // ReferenceError: can't access lexical declaration `foo' before initialization </code></pre> <p>And <code>let</code> variables can't be redeclared:</p> <pre><code>let foo = 123; // SyntaxError: redeclaration of let foo </code></pre> <p>Is there any way to take it out of the TDZ, so that I can assign values and read them?</p>