Why does checking for variable existence in jQuery callback cause a hard exception?
<p>Note that <code>doesNotExist</code> intentionally does not exist, the alert is never shown, and instead we're left with an error in the browser's console. What's special about running this code in a jQuery callback that makes it fail so hard like this?</p>

<p>HTML:</p>

<pre><code>&lt;div&gt;Shown! But we failed before the alert. Check your console...&lt;/div&gt;
</code></pre>

<p>CSS:</p>

<pre><code>div { display: none; }
</code></pre>

<p>JS:</p>

<pre><code>$('div').fadeIn(100, function() {
    if (doesNotExist) {
        alert('Nope');
    }
    else {
        alert('Still nope');
    }
});
</code></pre>

<p><a href="https://jsfiddle.net/mrpowell3j/gnhoheze/2/" rel="nofollow noreferrer">https://jsfiddle.net/mrpowell3j/gnhoheze/2/</a></p>