JS namespace Netbeans variable not declared
<p>When I was defining a namespace in JavaScript, Netbeans gave a <em>global variable not declared</em> error while I think it shouldn't. Why is this?<br/>
Demonstration code:</p>

<pre><code>var MyNamespace = new function () {
    var MyClass = function () {};
    MyClass.SOME_CONSTANT = 9; // MyClass not defined
    this.MyClass = MyClass; // MyClass not defined
};
</code></pre>

<p>I checked and this code works in IE (document mode IE 5) and Edge 13. The code is a <em>Module Pattern</em> like syntax like in <a href="https://stackoverflow.com/a/881611/4454665">this</a> answer.</p>

<p>EDIT: first declaring a variable is probably not useful, for a function inside the namespace will sometimes change the local variable instead of that in the public namespace, am I right? Still, I wonder why Netbeans gives me an error.</p>