JavaScript/jQuery and "top-level" functions
<p>When I peruse a jQuery-driven JavaScript source file, I see functions defined like so:</p>

<pre><code>$(document).ready(function() {
    ...
});

$(function {
    ...
});
</code></pre>

<p>I <em>think</em> I understand the first one: I assume its a function to fire once the entire page is downloaded, yes? If not please correct me!</p>

<p>What really confuses me is the second one. Is this an anonymous function? How/where does it get called? When does it get called (page load)?</p>

<p>I guess I'm used to seeing JavaScript function written the <em>old</em> way:</p>

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

<p>Then I just call <code>myFunction</code> anytime I need it. How does this "old" way compare to jQuery's constructs? Thanks for helping me understand any of this confusion!</p>
