How does browser read the JavaScripts, which should come first (set on the top)：event? function? or sub function
<p>A simple question.</p>

<p>I have a web project includes multi JavaScripts.</p>

<p>JS:</p>

<pre><code>// (1） Event

$('.input').keyup(function()
{
    keyUpFunction();    
});


// (2) Function

function keyUpFunction(){ ... }
</code></pre>

<p>(1),(2) which should come first in one javascript file? If the browser read the function first, does it store the funtion in memory and invoke it when scan the event. </p>

<p>In some case, the same function is defined in multi javascript . e.g.</p>

<pre><code>prm.add_endRequest(function() {
    fn1();
    fn2();
});

$(document).ready(.......)
</code></pre>

<p>Should I duplicate the function name and define each component in each js file.
or keep the function declare in one file and invoke sub-function composite the function?</p>
