JavaScript catch clause scope
<p>The <a href="http://es5.github.com/#x10.2">ECMAScript 5 spec</a> states the following:</p>

<blockquote>
  <p>Usually a Lexical Environment is associated with some specific
  syntactic structure of ECMAScript code such as a FunctionDeclaration,
  a WithStatement, or a Catch clause of a TryStatement and a new Lexical
  Environment is created each time such code is evaluated.</p>
</blockquote>

<p>If my understanding is correct, then when a new Lexical Environment is created in JavaScript, a new scope is entered, which is why variables declared inside a function are not visible outside of that function:</p>

<pre><code>function example() {
    var x = 10;
    console.log(x); //10
}
console.log(x); //ReferenceError
</code></pre>

<p>So in the above function declaration, a new Lexical Environment is created, which means <code>x</code> is not available in any outer Lexical Environments that may exist.</p>

<p>So the part of the quote above about Function Declarations seems to make sense. However, it also states that a new Lexical Environment is created for the Catch clause of a Try Statement:</p>

<pre><code>try {
    console.log(y); //ReferenceError so we enter catch
} 
catch(e) {
    var x = 10;
    console.log(x); //10
}
console.log(x); //10 - but why is x in scope?
</code></pre>

<p>So how does the scope of a <code>catch</code> block work? Do I have a fundamental misunderstanding of what a Lexical Environment is?</p>
