What is the diffference between these three types of variable declaration in javascript? : <p>I am new to JS and i have facing some issue on declaration of the Variables in three ways</p>

<p><a href="https://i.stack.imgur.com/P3xCX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/P3xCX.png" alt="These are test cases i have tried"></a></p>

<p>as my understanding </p>

<pre><code>a = "a";

</code></pre>

<p>and </p>

<pre><code>var a = "var a";
</code></pre>

<p>are (global declaration) same thing </p>

<p>but </p>

<pre><code>let a = "let a"
</code></pre>

<p>is declare as local variable </p>

<p>so as i have tested some combinations </p>

<pre><code>let a ="let a"
a ="a"
</code></pre>

<p>workes </p>

<p>but </p>

<pre><code>let a = "let a"
var a = "var a"
</code></pre>

<p>not works </p>

<p>could you tell me why is that ?</p>
