Is there any benefit in storing a function in a variable before assigning it to an event?
<h1>1</h1>

<pre><code>document.onkeydown = function(a) {
    //
};
</code></pre>

<h1>2</h1>

<pre><code>var a = function(a) {
    //
};
document.onkeydown = a;
</code></pre>

<p>I had the idea that maybe in the first case, the function needs to be <em>re-parsed</em> (for lack of better word) every time the event happens, whereas in the second case it just points to the already <em>parsed</em> function.</p>

<p>If not this, maybe there is another (any) difference.</p>

<p><strong>Update</strong></p>

<p>If I understand this correctly, there is a difference between these, and it's better to use the second.</p>

<h1>1</h1>

<pre><code>var a = window.onresize = function() {
    //
};
// ...
a();
</code></pre>

<h1>2</h1>

<pre><code>var a = function() {
    //
};
window.onresize = a;
// ...
a();
</code></pre>
