jquery basic of dollar sign - named vs anonymous
<p>I have a couple of interview questions</p>

<ol>
<li><p>What is the different between <code>$(function(){});</code> and <code>$(document).ready(function(){});</code></p></li>
<li><p>What is the difference between <code>$(function(){});</code> and <code>var func=function(){};</code> How are each of them called?</p></li>
<li><p>Given the following script</p>

<pre><code>&lt;script language="javascript"&gt;
$(function()
{
   var id=$("cssID");
   //do something with your id
   //your event to be added here
});
&lt;/script&gt;
</code></pre>

<p>How can you add an event, say, <code>onmouseout</code> that will work on the <code>id</code>?</p></li>
</ol>

<p>Here are my answers:</p>

<ol>
<li><p>They are the same, both are meant to run when the page document finishes loading</p></li>
<li><p>The first one is called automatically while the second one will be called via named reference; that is <code>func.called()</code>, for example.</p></li>
<li><p>Something like this: </p>

<pre><code>$(function()
{
    var id=$("cssID");
    //do something with your id
    //Oki
    id.onmouseout
    (function(){
      //do something
    });
});
</code></pre></li>
</ol>

<p>However my professor says I was wrong in all three. she explained things I am unsure and didn't dare to ask, she was mad about me. What are the correct answers and why are mine wrong?</p>
