Detecting if an object exists in IE
<p>Normally if you want to check if a feature is supported in a browser, you'd do a simple if statement like this:</p>

<pre><code>if (SomeFooFeature) { ... }
</code></pre>

<p>So in my application, I check for the AudioContext object, to avoid errors when trying to use it if it is not supported:</p>

<pre><code>if (AudioContext) {
    context = new AudioContext()
}
</code></pre>

<p>But when I do that, IE complains that "AudioContext" is undefined.
<strong>Uhm, what?</strong> Didn't I just check for that?</p>

<p>Infact, just doing <code>if (Foo) { ... }</code> gives the same error.</p>

<p>Why? How can something this trivial not work in Internet Explorer?</p>